pactflow / swagger-mock-validator

Other
14 stars 5 forks source link

feat: Respect request and response content-types #22

Closed vwong closed 1 year ago

vwong commented 1 year ago

Both request and response bodies can have different schemas based on its content-type. Prior to this, we default to using the schema associated with application/json as the schema. This is incorrect when there is a vendor extension, such as application/vnd.api+json, whether that is the only schema or alongside another.

This PR dynamically switches the relevant schema based on its content-type.

vwong commented 1 year ago

Restored the old behaviour such that interaction passes, when OAS is missing application/json in supported list of request bodies. But where it would've failed, we log this to stderr.

mefellows commented 1 year ago

Restored the old behaviour such that interaction passes, when OAS is missing application/json in supported list of request bodies. But where it would've failed, we log this to stderr.

Awesome, thanks Voon.