Milda
03/14/2024, 8:04 AMMilda
03/14/2024, 8:06 AM"parameters": [
{
"name": "request",
"in": "query",
"required": true,
"schema": {
"$ref": "#/components/schemas/QuoteRequest"
}
}
]Milda
03/14/2024, 8:07 AM"QuoteRequest": {
"required": [
"amount",
"buy_currency",
"fixed_side",
"sell_currency",
"tenor"
],
"type": "object",
"properties": {
"amount": {
"type": "number"
},
"buy_currency": {
"maxLength": 3,
"minLength": 3,
"type": "string"
},
"sell_currency": {
"maxLength": 3,
"minLength": 3,
"type": "string"
},
"fixed_side": {
"type": "string",
"enum": [
"buy",
"sell"
]
},
"delivery_date": {
"type": "string"
},
"tenor": {
"pattern": "tod|tom|spot|forward",
"type": "string"
}
}
}Milda
03/14/2024, 8:08 AMMilda
03/14/2024, 8:09 AM"query": {
"amount": [
900000
],
"buy_currency": [
"RON"
],
"sell_currency": [
"USD"
],
"fixed_side": [
"sell"
],
"delivery_date": [
"2024-03-12"
],
"tenor": [
"tod"
]
}Milda
03/14/2024, 8:09 AM"matchingRules": {
"query": {
"$.amount": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
},
"$.buy_currency": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
},
"$.sell_currency": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
},
"$.fixed_side": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
},
"$.delivery_date": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
},
"$.tenor": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
}
}
}
}Milda
03/14/2024, 8:10 AMValue is incompatible with the parameter defined in the spec file: must have required property 'value'Milda
03/14/2024, 8:11 AMequality rather than type but that did not fix the error (unless I used the wrong matcher, with the intention of matching an enum value described in oas)Milda
03/14/2024, 8:11 AMQuery parameter is not defined in the spec file: sell_currency for all parametersMilda
03/14/2024, 8:11 AMBas Dijkstra
03/14/2024, 8:50 AMBas Dijkstra
03/14/2024, 8:51 AMMilda
03/14/2024, 8:59 AMMilda
03/14/2024, 8:59 AMBas Dijkstra
03/14/2024, 10:52 AMBas Dijkstra
03/14/2024, 10:58 AMBas Dijkstra
03/14/2024, 11:02 AM"amount": [
900000
]
whereas the spec says they should be literals, e.g.
"amount": {
"type": "number"
},
?Milda
03/14/2024, 11:15 AMMilda
03/14/2024, 11:15 AMBas Dijkstra
03/14/2024, 11:23 AM{
"consumer": {
"name": "order_consumer"
},
"provider": {
"name": "payment_provider"
},
"interactions": [
{
"description": "GET /payment/this_is_not_a_valid_payment_id -> 400",
"request": {
"method": "GET",
"path": "/payment/this_is_not_a_valid_payment_id",
"headers": {
"content-length": "0",
"connection": "close",
"accept-encoding": "gzip, x-gzip, deflate",
"accept": "application/json, application/*+json",
"user-agent": "Apache-HttpClient/5.2.1 (Java/17.0.3.1)"
}
},
"response": {
"status": 400
}
},
{
"description": "GET /payment/00000000-0000-0000-0000-000000000000 -> 404",
"request": {
"method": "GET",
"path": "/payment/00000000-0000-0000-0000-000000000000",
"headers": {
"content-length": "0",
"connection": "close",
"accept-encoding": "gzip, x-gzip, deflate",
"accept": "application/json, application/*+json",
"user-agent": "Apache-HttpClient/5.2.1 (Java/17.0.3.1)"
}
},
"response": {
"status": 404
}
},
{
"description": "GET /payment/228aa55c-393c-411b-9410-4a995480e78e -> 200",
"request": {
"method": "GET",
"path": "/payment/228aa55c-393c-411b-9410-4a995480e78e",
"headers": {
"content-length": "0",
"connection": "close",
"accept-encoding": "gzip, x-gzip, deflate",
"accept": "application/json, application/*+json",
"user-agent": "Apache-HttpClient/5.2.1 (Java/17.0.3.1)"
}
},
"response": {
"status": 200,
"headers": {
"content-type": "application/json"
},
"body": {
"id": "8383a7c3-f831-4f4d-a0a9-015165148af5",
"orderId": "228aa55c-393c-411b-9410-4a995480e78e",
"status": "payment_complete",
"amount": 42,
"description": "Payment for order 228aa55c-393c-411b-9410-4a995480e78e"
}
}
}
]
}
Without more specific details about element value matching rules, I assume Pactflow matches on type.Bas Dijkstra
03/14/2024, 11:25 AMBas Dijkstra
03/14/2024, 11:26 AMYousaf Nabi (pactflow.io)
Milda
03/14/2024, 11:58 AMMilda
03/14/2024, 11:58 AMMilda
03/14/2024, 12:00 PMBas Dijkstra
03/14/2024, 12:01 PMquery you're referring to query parameters, right? Sorry, I'm not fluent in OpenAPI spec 🙂Milda
03/14/2024, 12:01 PMMilda
03/14/2024, 12:01 PM?Milda
03/14/2024, 12:01 PMBas Dijkstra
03/14/2024, 12:02 PMMilda
03/14/2024, 12:06 PMrequestQuery[queryName].join is not a function issue, which was raised in the pastMilda
03/14/2024, 12:08 PMmatching rules are not considered in the bi directional comparison so adding them to the contract is unnecessary@Yousaf Nabi (pactflow.io) is it possible to force check for values for those that require the value to be in an enum for the openapi spec? wondering if that's whats causing this problem here?
Milda
03/14/2024, 12:12 PMMilda
03/14/2024, 12:14 PMMilda
03/14/2024, 12:15 PMBas Dijkstra
03/14/2024, 12:16 PMYousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Bas Dijkstra
03/14/2024, 12:20 PM{
"consumer": {
"name": "order_consumer"
},
"provider": {
"name": "payment_provider"
},
"interactions": [
{
"description": "GET /payment -> 400",
"request": {
"method": "GET",
"path": "/payment",
"query": "order=this_is_not_a_valid_payment_id",
"headers": {
"content-length": "0",
"connection": "close",
"accept-encoding": "gzip, x-gzip, deflate",
"accept": "application/json, application/*+json",
"user-agent": "Apache-HttpClient/5.2.1 (Java/17.0.3.1)"
}
},
"response": {
"status": 400
}
},
{
"description": "GET /payment -> 404",
"request": {
"method": "GET",
"path": "/payment",
"query": "order=00000000-0000-0000-0000-000000000000",
"headers": {
"content-length": "0",
"connection": "close",
"accept-encoding": "gzip, x-gzip, deflate",
"accept": "application/json, application/*+json",
"user-agent": "Apache-HttpClient/5.2.1 (Java/17.0.3.1)"
}
},
"response": {
"status": 404
}
},
{
"description": "GET /payment -> 200",
"request": {
"method": "GET",
"path": "/payment",
"query": "order=228aa55c-393c-411b-9410-4a995480e78e",
"headers": {
"content-length": "0",
"connection": "close",
"accept-encoding": "gzip, x-gzip, deflate",
"accept": "application/json, application/*+json",
"user-agent": "Apache-HttpClient/5.2.1 (Java/17.0.3.1)"
}
},
"response": {
"status": 200,
"headers": {
"content-type": "application/json"
},
"body": {
"id": "8383a7c3-f831-4f4d-a0a9-015165148af5",
"orderId": "228aa55c-393c-411b-9410-4a995480e78e",
"status": "payment_complete",
"amount": 42,
"description": "Payment for order 228aa55c-393c-411b-9410-4a995480e78e"
}
}
}
]
}Bas Dijkstra
03/14/2024, 12:21 PMMilda
03/14/2024, 12:22 PM& would be accepted in this caseBas Dijkstra
03/14/2024, 12:22 PMBas Dijkstra
03/14/2024, 12:28 PMBas Dijkstra
03/14/2024, 12:29 PMBas Dijkstra
03/14/2024, 12:29 PMMilda
03/14/2024, 12:31 PMMilda
03/14/2024, 12:32 PMYousaf Nabi (pactflow.io)
Bas Dijkstra
03/14/2024, 12:33 PMBas Dijkstra
03/14/2024, 12:40 PM"query": "order=228aa55c-393c-411b-9410-4a995480e78e&status=complete",Bas Dijkstra
03/14/2024, 12:41 PMMilda
03/14/2024, 12:41 PMMilda
03/14/2024, 12:41 PMspringdoc-openapi-starter-webmvc-ui FWIWBas Dijkstra
03/14/2024, 12:43 PMBas Dijkstra
03/14/2024, 12:43 PMMilda
03/14/2024, 12:43 PMMilda
03/14/2024, 12:44 PMBas Dijkstra
03/14/2024, 12:44 PMMilda
03/14/2024, 12:44 PMMilda
03/14/2024, 12:44 PMBas Dijkstra
03/14/2024, 12:45 PMMilda
03/14/2024, 12:47 PMMilda
03/14/2024, 12:48 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Milda
03/15/2024, 6:33 AMMilda
03/15/2024, 6:36 AMBas Dijkstra
03/15/2024, 6:41 AMBas Dijkstra
03/15/2024, 6:42 AMvalue by the way :)Milda
03/15/2024, 8:09 AMMilda
03/15/2024, 8:45 AM"parameters": [
{
"name": "request",
"in": "query",
"required": true,
"schema": {
"$ref": "#/components/schemas/QuoteRequest"
}
}
]
where the name "request" is the key and the schema ref defining the parameters is the value. how should the name be defined here in order to make use of the reference being a query object?
"QuoteRequest": {
"required": [
"amount",
"buy_currency",
"fixed_side",
"sell_currency",
"tenor"
],
"type": "object",
"properties": {
"amount": {
"type": "number"
},
"buy_currency": {
"maxLength": 3,
"minLength": 3,
"type": "string"
},
"sell_currency": {
"maxLength": 3,
"minLength": 3,
"type": "string"
},
"fixed_side": {
"type": "string",
"enum": [
"buy",
"sell"
]
},
"delivery_date": {
"type": "string"
},
"tenor": {
"pattern": "tod|tom|spot|forward",
"type": "string"
}
}
},Milda
03/15/2024, 8:48 AMrequest.amount=90000&request.buy_currency=GBP and such?Milda
03/15/2024, 9:34 AMBas Dijkstra
03/15/2024, 10:22 AMMilda
03/15/2024, 11:39 AM"parameters": [
{
"name": "amount",
"in": "query",
"required": true,
"schema": {
"type": "number"
}
},
{
"name": "buy_currency",
"in": "query",
"required": true,
"schema": {
"maxLength": 3,
"minLength": 3,
"type": "string"
}
},
{
"name": "sell_currency",
"in": "query",
"required": true,
"schema": {
"maxLength": 3,
"minLength": 3,
"type": "string"
}
},
{
"name": "fixed_side",
"in": "query",
"required": true,
"schema": {
"type": "string",
"enum": [
"buy",
"sell"
]
}
},
{
"name": "delivery_date",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "tenor",
"in": "query",
"required": true,
"schema": {
"pattern": "tod|tom|spot|forward",
"type": "string"
}
}
]Milda
03/15/2024, 11:46 AM"parameters": [
{
"name": "request",
"in": "query",
"required": true,
"schema": {
"$ref": "#/components/schemas/QuoteRequest"
}
}
]
because of that name: request being (presumably) treated as a key for the query "object"Bas Dijkstra
03/15/2024, 11:51 AMMilda
03/15/2024, 11:58 AMhost:port/v1/quotes?amount=113&buy_currency=SGD&sell_currency=AUD&fixed_side=buy&delivery_date=2024-04-15&tenor=spot' \ + headers normally worksMilda
03/15/2024, 11:58 AMMilda
03/15/2024, 11:59 AMBas Dijkstra
03/15/2024, 12:34 PM"style": "form" and "explode": true to the schema, would that make it work?Milda
03/15/2024, 1:11 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
hey Matt, are the snippets are posted earlier not sufficient?forgive me, but we spend a lot of time helping people out on forums. Whilst I could probably put together an example OAS/pact file from the snippets it would improve the likelihood if a repro was provided.
Matt (pactflow.io / pact-js / pact-go)
parameters example here: https://github.com/pactflow/bdct-oas-examples (see README)
I think Bas is on the right track. My assumption is that there is a bug (or perhaps, it just never considered) in resolving query parameters in this fashion.
It’s worth a quick play around, but I suspect the additional level of indirection is what’s making it look for value rather than seeing the $ref directlyMatt (pactflow.io / pact-js / pact-go)
Bas Dijkstra
03/18/2024, 5:23 AMMilda
03/18/2024, 8:17 AM