Hello there :wave: I have a question regarding key...
# pactflow
s
Hello there đź‘‹ I have a question regarding keyword support
oneOf
in the schema...Using BDCT workflow and we have
oneOf
keyword in the schema and I had followed the instructions here : https://docs.pactflow.io/docs/bi-directional-contract-testing/contracts/oas/keyword-support/ and dereferencing and inlining $refs using
swagger-cli
before publishing to pact broker...When I set the
additionalProperties:false
to the oneOf
refs
as mentioned here: https://github.com/pactflow/bdct-oas-examples/blob/main/examples/oneOf/oneOf.oas.yml#LL44C7-L44C34 the contract is failing.... We also use these oneOf refs in the include param...Wondering if that could be the issue..any suggestions?
To provide more context say
/v1/students
endpoint which contains query param like
full_time
,
part_time
In the response based on the query param include requested ,the response would contain the one of them fullTime or partTime object When I set
additionalProperties:false
to
full_time
and say fullTime has properties
id, type, attributes
then the contract is failing
Response body is incompatible with the response body schema in the spec file: should NOT have additional properties - id
One of the consumer is using the student endpoint with include param
full_time
"query": "include=full_time",
m
Have you added the
additionalProperties: true
bit as noted here: https://github.com/pactflow/bdct-oas-examples/blob/main/examples/oneOf/oneOf.oas.yml#L26
not on the schema, but at the same level the
oneOf
is used?
s
additionalProperties is set to true here:
m
thanks, are you able to share your OAS + pact so we can check?
s
Would it suffice if I share it with support@pactflow.io?
m
best going to here now 👇 (smartbearsupport)
gratitude thank you 1
s
Please create a ticket here with the issue details so that we can properly track the resolution and the PactFlow product support team will continue to work through it with you: https://support.smartbear.com/pactflow/message
m
Wait, sorry,
additionalProperties
needs to be on the property adjecent to
oneOf
(see screenshot). In your case, it looks to be much higher up the hierarchy, which may be invalid or be dangerously allowing additional properties where it shouldn’t (or just unrelated)
s
Thanks Matt! I've created a support ticket with OAS + pact and also moved the additionalProperties to the property adjacent to
oneOf
as you have suggested...
m
did moving that help?
s
unfortunately no...contracts are still failing for the same reason
m
I’ll DM you to check-in on the ticket…