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

Ability to model different query parameter serialisation formats #106

Open
mefellows opened this issue Mar 18, 2024 · 0 comments
Open

Ability to model different query parameter serialisation formats #106

mefellows opened this issue Mar 18, 2024 · 0 comments
Labels
enhancement Indicates new feature requests

Comments

@mefellows
Copy link
Member

The current Pact Specification stores query parameters as maps (change introduced in v3 of the spec).

This change made it impossible to infer the various styles of real world query string usage, as the serialisation format is not stored in the contract.

For example, given the following query section from a pact:

"foo": ["bar", "baz"]

A client has at least 2 common choices in how to send this:

/?foo=bar&foo=baz

and

/?foo[]=bar&foo[]=baz

It's unclear (i.e. the spec doesn't define) what format the verifier would send the query string in during verification.

It gets more complicated with nested objects, something that is common in APIs that have complex queries encoded as query strings instead of body (see e.g. GraphQL)

One approach would be to allow the test author to specify the encoding style for use by the mock server and verifier.

OpenAPI has a system capable of modelling the various behaviours, this could be a good starting point.

@mefellows mefellows added the enhancement Indicates new feature requests label Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

1 participant