Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProviderStateGenerator only supports path matching via IntegrationJson (FFI) #448

Open
mefellows opened this issue Jun 21, 2024 · 1 comment
Labels
bug Indicates an unexpected problem or unintended behavior triage This issue is yet to be triaged by a maintainer

Comments

@mefellows
Copy link
Member

Via: pact-foundation/pact-js#1223

Relates to : #447

Upon investigating pact-foundation/pact-js#1223, the following use cases stopped working - possibly they were only working because of the presence of the type matcher which masked the problem:

query strings:

2024-06-21T03:55:39.588275Z DEBUG tokio-runtime-worker pact_matching: --> Mismatches: [QueryMismatch { parameter: "accountNumber", expected: "{\"expression\":\"${accountNumber}\",\"value\":\"100\"}", actual: "100", mismatch: "Expected query parameter 'accountNumber' with value '{\"expression\":\"${accountNumber}\",\"value\":\"100\"}' but was '100'" }]
2024-06-21T03:55:39.588472Z DEBUG tokio-runtime-worker pact_mock_server::hyper_server: Request did not match: Request did not match - HTTP Request ( method: GET, path: /accounts/search/findOneByAccountNumberId, query: Some({"accountNumber": ["{\"expression\":\"${accountNumber}\",\"value\":\"100\"}"]}), headers: Some({"Accept": ["application/hal+json"]}), body: Missing )    0) Expected query parameter 'accountNumber' with value '{"expression":"${accountNumber}","value":"100"}' but was '100'

Bodies:

2024-06-21T03:57:04.428658Z DEBUG tokio-runtime-worker pact_matching: --> Mismatches: [BodyMismatch { path: "$.accountNumber", expected: Some(b"{\"expression\":\"${accountNumber}\",\"value\":100}"), actual: Some(b"100"), mismatch: "Type mismatch: Expected 100 (Integer) to be the same type as {\"expression\":\"${accountNumber}\",\"value\":100} (Object)" }]
2024-06-21T03:57:04.428951Z DEBUG tokio-runtime-worker pact_mock_server::hyper_server: Request did not match: Request did not match - HTTP Request ( method: POST, path: /accounts/search/findOneByAccountNumberIdInBody, query: None, headers: Some({"Content-Type": ["application/json"], "Accept": ["application/hal+json"]}), body: Present(63 bytes, application/json) )    0) $.accountNumber -> Type mismatch: Expected 100 (Integer) to be the same type as {"expression":"${accountNumber}","value":100} (Object)

And presumably headers (I don’t have a test for this).

The only one that works is when it's used in a path expression.

It looks like the expression is not being set properly, as you can see the JSON format instead of the expected value.

@mefellows mefellows added bug Indicates an unexpected problem or unintended behavior triage This issue is yet to be triaged by a maintainer labels Jun 21, 2024
@mefellows
Copy link
Member Author

Further investigation needed to identify the source of the problem, we may also need to update https://github.com/pact-foundation/pact-reference/blob/master/rust/pact_ffi/IntegrationJson.md to clarify the use of the FFI interop format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior triage This issue is yet to be triaged by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant