-
This line mentions the option to not repeat the child schemas using OpenAPI-Specification/versions/3.1.1.md Line 3379 in 428007d
But how does a response type look like? myResponseType:
$ref: '#/components/schemas/Pet' Is this all? How does the caller know a specific sub type of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@hfhbd The What's going on here is that for validation purposes, the @mikekistler is working on the latest attempt to improve I know that's not a satisfactory answer, but it's the best I have for you. |
Beta Was this translation helpful? Give feedback.
@hfhbd The
allOf
syntax fordiscriminator
is weird for the reason you mention. Among others. We keep trying to explain it better, but AFAIK none of the people who came up with it are still active with the project, so it's a bit of archaeology and we keep finding new surprises.What's going on here is that for validation purposes, the
allOf
approach only works if you are validating using a child schema, which means you already have to know what child it will be. This is becausediscriminator
is not allowed to change the validation outcome, because doing so in theallOf
case would outright contradict the JSON Schema specification, for reasons that are too complex to go into here. JSON Schem…