Discussions
Boolean enums always set to `true`
11 months ago by Tom Zandman
In writing OpenAPI files, when I want to enforce a fixed value for some key, I use an enum with a single item, as such:
ExampleSchema01:
type: object
properties:
FixedValueProperty:
type: string
enum:
- "This is the only possible value for FixedValueProperty."
However, when I try doing the same for boolean values, the Readme API reference section always renders it as true
, even if the enum specifies false
as the only possible value.
For example:
ExampleSchema02:
type: object
properties:
FixedBooleanTrue:
type: boolean
enum:
- true
FixedBooleanFalse:
type: boolean
enum:
- false
Readme's API reference section will render both FixedBooleanTrue
and FixedBooleanFalse
as enums with true
and the only possible value.
Why is that? How can I fix this? Is there a workaround?