Closed renato04 closed 2 years ago
Hi @renato04,
Could you expand on your use case please, with examples, thank you!
Pact.Net will allow you to create a Pact consumer contract file and alone is agnostic about an OpenAPI definition which would describe a provider API's behaviour.
Hi @YOU54F
The architect team designed the OpenApi's definition before it gets developed. So we need a way to validate if the developer's team had developed the API correctly based on some responses from this API against the OpenApi definition.
We need to test the contract without a running API. Just verify a JSON response complies with an OpenApi definition.
https://docs.pactflow.io/docs/examples/bi-directional/provider/dotnet/
The above sample repo shows Pact.NET being used to generate a consumer contract, and utilises Pactflow to allow the provider to upload an OpenAPI spec.
There is a compatible provider to see the flow end to end
Thank you @YOU54F!
Must I have a PactFlow subscription to achieve that?
To be able to upload OAS contracts, to a Pactflow broker, you would indeed need a Pactflow subscription, that feature is not present in the Open Source Pact Broker. The starter plan is free, so up to you :)
There is open source tooling available which will allow you to compare pacts against OpenAPI specifications, which you can use in your workflow.
https://bitbucket.org/atlassian/swagger-mock-validator/src/master/
Pactflow uses a fork of the above as part of Bi-Directional Contract testing.
Feel free to jump on our Pact Slack group if you haven't already, everyone is really friendly and open to chatting https://slack.pact.io
The architect team designed the OpenApi's definition before it gets developed. So we need a way to validate if the developer's team had developed the API correctly based on some responses from this API against the OpenApi definition.
The use case is aligned with my way of thinking, and incorporating it nicely with a consumer driven contract testing flow to complete the loop is on my agenda, as I would be nice to show about BDCT/CDCT compliment each other!
Hi!
I'd like to test just a string JSON against the swagger definition. Is there a way to achieve that with Pact.Net?
Thank you!