Appending to referenced enum #2943
|
Would love to be able to append to an existing enum. Not all values are applickable in all cases, this means that i need to redefine the enum. Especially when used together with deepmap's oapi-gen this would be nice. Example: type: string
enum: [Motion, Push, Voice]Doorbell.yaml: schema:
$ref: "#/shared/components/schemas/SensorType.yaml"
description: Sensor to trigger doorbellAlarm.yaml: schema:
$ref: "#/shared/components/schemas/SensorType.yaml"
append: [ Temp, Vibration, SignalLoss ]
description: Sensor to trigger alarm |
Answered by
webron
Jun 13, 2022
Replies: 2 comments
|
This is more of a JSON Schema request than an OpenAPI one. You can achieve what you're looking for using schema:
oneOf:
- $ref: "#/shared/components/schemas/SensorType.yaml"
- enum: [ Temp, Vibration, SignalLoss ]
description: Sensor to trigger alarm |
0 replies
Answer selected by
martinwangen
|
Answered and accepted, closing. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is more of a JSON Schema request than an OpenAPI one. You can achieve what you're looking for using
oneOforanyOfdepending on the content of the different enums.