Hello, I'm sifting through the pactflow documentat...
# pactflow
j
Hello, I'm sifting through the pactflow documentation in an effort to publish some provider contracts which should be defined by OAS. I'm failing to fully understand how to use the
verifier
and related cli flags. I've run through the killercoda Bi-Directional Contract Testing workshop, and understand how dredd is being used, but how would one provide the same information to the tool when their generating their code from the spec (option 1 workflow from step 3)? TLDR; 1. Is there a more detailed description for what the
--verifier
(and related) flags do in the
pactflow publish-provider-contract
command? 2. How should this be used when code is being generated from the spec instead of the spec being written afterward?
m
That flag is really to capture the tool/process used to generate and test the contract. If you are simple generating the contract, then you can put whatever you want in there e.g. “swashbuckle” or whatever tool you used to generate the OAS. Just note there are circumstances where generating the contract from code is still unsafe (e.g. if you have an unimplemented controller, you can stilly easily generate an OAS that looks ok but is not actually doing anything). Personally, I would recommend against relying solely on this way of doing things, and would want to see at least some tests checking your endpoints return the right shaped data as per our examples.
j
thanks!
let me re-iterate though. The contract itself is not being generated. The contract (OAS) defines the interface (in code) to be generated. But it sounds like your recommendation is to test that the same way regardless
👍 1
m
Correct, either way you can have a non-implemented controller. You may well have other important checks and balances that would prevent this, so of course it’s up to you!
If you’re confident that the OAS represents your code, then just put in “n/a” or whatever you need. It might be helpful to track this over time as we store it in Pactflow