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
I have a super-class ShapeBase, with objects looking like {"kind":"...","x":1,"y":2} and sub-classes Circle (e.g. {"kind":"Circle","x":1,"y":2,"r":3} and Rectangle (e.g. {"kind":"Rectangle","x":1,"y":2,"w":3,"h":4}).
Given that the discriminator declaration constrains that for a Shape of type Circle the "kind" must be "Circle", I'd assume the fields of Circle being required, and those of Rectangle not being required.
I have a super-class
ShapeBase
, with objects looking like{"kind":"...","x":1,"y":2}
and sub-classesCircle
(e.g.{"kind":"Circle","x":1,"y":2,"r":3}
andRectangle
(e.g.{"kind":"Rectangle","x":1,"y":2,"w":3,"h":4}
).Given that the discriminator declaration constrains that for a
Shape
of typeCircle
the "kind" must be "Circle", I'd assume the fields ofCircle
being required, and those ofRectangle
not being required.Input: {"kind":"Circle","x":1,"y":2}
Expected: Validation fails, Actual: Validation fails🟢
Input: {"kind":"Circle","x":1,"y":2,"w":3}
Expected: Validation fails, Actual: Validation fails🟢
Input: {"kind":"Circle","x":1,"y":2,"w":3,"h":4}
Expected: Validation fails, Actual: Validation passes🔴
I used the example request validation from the README and the following openapi.yml:
The text was updated successfully, but these errors were encountered: