pactflow / swagger-mock-validator

Other
14 stars 5 forks source link

fix: handle type:object in schema composition #47

Closed vwong closed 12 months ago

vwong commented 12 months ago

Schemas are normally written like:

oneOf: [
  { $ref: "A" },
  { $ref: "B" },
]

But some schemas have a superfluous definition included:

type: "object",
oneOf: [
  { $ref: "A" },
  { $ref: "B" },
]

This breaks because we transform schemas based on type: "object" alone. This PR checks for the above scenario, so that we don't break when faced with such schemas.