Since OpenAPI can be used to generate client code, it is good to support some constant value in the API itself.
Use case: When you add type info to a class as a properties, we need that property for deserialization and the value of this property will never change.
Can you not do this with an enum property which only has one value?
MySchema:
type: object
properties:
MyProperty:
type: string
enum:
- constantValue
Possibly related: #1313
Can you not do this with an
enumproperty which only has one value?
Yes thats how it needs to be done now, but it's a bit verbose and it doesn't look nice in your documentation (generated web pages), where it will show as an expandable list of one item VS just the string value.
Closing, as this is a dupe of #1313 as @hkosova observed.
Most helpful comment
Can you not do this with an
enumproperty which only has one value?