You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The discriminator is used with anyOf or oneOf keywords only.
Side note
This also breaks openapi based code generators that properly support polymorphism honoring discriminators
Solution
Use the result of the invocation of GenerateConcreteSchema, filling the anyOf/oneOf field. More specifically, we think that oneOf better suits this use case.
The text was updated successfully, but these errors were encountered:
ldeluigi
changed the title
Discriminated polymorphism does not populate anyOf and oneOf, in contrast with Swagger documentation
[Bug] Discriminated polymorphism does not populate anyOf and oneOf, in contrast with Swagger documentation
Nov 22, 2024
Problem
The problematic line is this:
Swashbuckle.AspNetCore/src/Swashbuckle.AspNetCore.SwaggerGen/SchemaGenerator/SchemaGenerator.cs
Line 416 in e727e8d
This line properly generates subtype definitions but doesn't populate any of the
anyOf
/oneOf
properties, resulting in a "broken" swagger document.Quoting the Swagger doc:
Side note
This also breaks openapi based code generators that properly support polymorphism honoring discriminators
Solution
Use the result of the invocation of
GenerateConcreteSchema
, filling theanyOf
/oneOf
field. More specifically, we think that oneOf better suits this use case.The text was updated successfully, but these errors were encountered: