Hey, I want to publish provider open API schema. C...
# pact-broker
a
Hey, I want to publish provider open API schema. Could you please suggest me correct API for that ?
I was trying to use endpoint from here, but it doesn't work as expected. When I publish contract for second pacticipant(provider) then it overrides the pact of the first pacticipant(provider) as well
y
Hi @Ashok that is the correct script as per our docs, but used from our example repo. We aim to have these in the CLI soon https://docs.pactflow.io/docs/bi-directional-contract-testing/contracts/oas#publishing-the-provider-contract--results-to-pactflow There is a request details section which describes the payload I assume your providers have distinct names?
a
Yes, providers do have the distinct names
y
And in each case, in your POST request, in the URL, are you providing a different name for the provider, shown as
${PACTICIPANT}
in the above snippet?
When I publish contract for second pacticipant(provider) then it overrides the pact of the first pacticipant(provider) as well
I am actually not quite sure what you mean. could you list the explicit steps. it sounds like you are 1. Uploading an oas spec for provider 1 2. Uploading an oas spec for provider 2.
and you are seeing the Pact of the first provider being over-ridden? This is what I am not quite sure about Do you mean the oas spec of provider 1 is being overwritten? Pact files would be created on the consumer side, the provider would either read these pacts for verification in CDCT or the provider would upload an OAS spec and evidence (as a provider contract) for BDCT.
a
And in each case, in your POST request, in the URL, are you providing a different name for the provider, shown as
${PACTICIPANT}
in the above snippet? (edited) Yes, different provider and I am using PUT method
Do you mean the oas spec of provider 1 is being overwritten? Yes, OAS of spec1 is getting overwritten
I am explaining the steps below: 1, Uploading OASSpec1 for provier 1 2, Uploading OASSpec1(With little in change in schema) for provier 2 3, OASSpec1 of provider2 overrides the OASSpec1 of provider1
thank you 1
y
So I have tested this out on my PF broker. Here we have provider foo2 (version foo2) and provider foo3 (version foo3) The swaggers are different in that fact, one have the name product2 and product3 respectively. When viewed via the sidebar, the right hand pane isn't showing the correct content, here when selecting foo2, is displays foo3. clicking on view contract in both cases displays the foo3 provider contract. Note the foo2 provider contract does exist and hasn't been overwritten, I was able to navigate to it via the URL path https://you54f.pactflow.io/contracts/bi-directional/provider/foo2/version/foo2/provider-contract but the hyperlinking in the UI isn't correct. Will raise this with the team. I believe you should be able to get your correct contract by using a URL structure similar to above with your 2nd provider name and version
I also noticed these docs mention a POST request, but it is PUT like you mentioned, so will get that updated https://docs.pactflow.io/docs/bi-directional-contract-testing/contracts/oas/#request-details I will get those examples on the public testdemo broker, and get a report raised 👍
Thanks for raising @Ashok
a
ok, let me know once this resolved.
With the other Url, I get the below error.
y
I captured the issue against this pull request to demonstrate it https://github.com/pactflow/example-provider-dredd/pull/1 and the contracts are uploaded to the testdemo broker https://testdemo.pactflow.io I got the same message, when I had a mismatch in provider version in my URL (not going by what was displayed in the UI)
👍 1
b
@Ashok I'll have the fix out for this shortly.
👍 1
a
Great, thanks 🙂
y
I've retested that and it appears to be working fine for me @Ashok, so I have closed the reproduction PR. Thanks for raising and trying out our new feature!
👍 1
a
@Yousaf Nabi (pactflow.io) @Beth (pactflow.io/Pact Broker/pact-ruby) I have also tested this, works fine now. Thanks!
🎉 1