Arthur Toper
04/04/2022, 4:00 PM... on
rather than ...on
, etc.), according to the GraphQL client library we are using (urql), but i feel that this approach seems a little brittle currently.
IMO, with GraphQL, the 'contract' is the strongly-typed schema the technology provides, rather than the precise way in which a client interacts with it. putting this another way, if i make a small change to the query a given client makes, i don't feel that should be regarded as a change of contract, yet so far as i can see, this is how the Pact GraphQLInteraction stuff is currently set up.
i was wondering whether, rather than providing a full GraphQL query string, it would be possible to build some sort of strongly-typed schema-based resolver for providing the mock API functionality? this could leverage existing tools (e.g. https://www.graphql-code-generator.com), and still capture interactions for playback against the server logic (in the spirit of Pact), but the developer experience might be somewhat nicer and more idiomatic.Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Arthur Toper
04/05/2022, 8:09 AMArthur Toper
04/05/2022, 8:10 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Arthur Toper
04/05/2022, 8:21 AMArthur Toper
04/05/2022, 8:22 AMMatt (pactflow.io / pact-js / pact-go)
Arthur Toper
04/05/2022, 9:49 AMArthur Toper
04/05/2022, 9:49 AMArthur Toper
04/05/2022, 9:49 AMArthur Toper
04/05/2022, 9:51 AMArthur Toper
04/05/2022, 9:51 AMArthur Toper
04/05/2022, 9:53 AMMatt (pactflow.io / pact-js / pact-go)
if, for some reason, a given consumer wants to change the name of a field it receives from the API (as with the name->firstName example i gave earlier), this is something which would be transparent to the provider implementationI don’t see how this wouldn’t break any type of contract. Either, the provider has the field or it doesn’t. If it gets renamed in the process by the consumer, sure, that’s up to them and is outside the scope of any contract test (Pact included)
Matt (pactflow.io / pact-js / pact-go)
Arthur Toper
04/05/2022, 10:25 AMArthur Toper
04/05/2022, 10:25 AMMatt (pactflow.io / pact-js / pact-go)
Arthur Toper
04/05/2022, 10:26 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
or more accurately, i think that currently Pact does not support GraphQL in an idiomatic waythis is definitely true
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Arthur Toper
04/05/2022, 10:28 AMArthur Toper
04/05/2022, 10:28 AMMatt (pactflow.io / pact-js / pact-go)
Arthur Toper
04/05/2022, 10:29 AMMatt (pactflow.io / pact-js / pact-go)
Arthur Toper
04/05/2022, 10:30 AMArthur Toper
04/05/2022, 10:32 AMArthur Toper
04/05/2022, 10:33 AMArthur Toper
04/05/2022, 10:33 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Arthur Toper
04/05/2022, 10:34 AM