nadyita
25 days agoNew Contributor
Reusable nullable enums?
If I define an enum like so
components:
schemas:
Color:
type: string
enum:
- black
- white
- red
- green
- blue
How would I go and allow an object to have a property with this component or null? The specs state, that I cannot just set nullable: true, but also have to add null to the list of allowed values for the enum. But null is not always a valid value for Color, only in some cases. Does this rule apply when referencing a component as well, or is nullable: true enough in this case?