Add values to an existing enum in an array
See original GitHub issueHello,
I’m new at OpenAPI. I have an object with 2 versions, and a base enum containing Cat, Dog and Rabbit. base.yaml:
pet:
type: string
enum:
- Cat
- Dog
- Rabbit
In v1(v1.yaml) object, I import the base enum in an array as following:
pets:
xml:
name: pets
wrapped: true
properties:
pet:
allOf:
- $ref: './base.yaml#/components/schemas/pet'
In v2 object (v2.yaml file), I want to add some values to the base enum : Horse and Parrot. I’m doing as following:
pets:
xml:
name: pets
wrapped: true
properties:
pet:
allOf:
- $ref: './v1.yaml#/components/schemas/pets/properties/pet'
- $ref: './v2.yaml#/components/schemas/pet'
pet:
type: string
enum:
- Horse
- Parrot
I encounter a problem: alone, v1 works fine. When I add the v2 object to be able to switch version, the pet list of version 1 takes the values of version 2.
How can I have v1 values for v1 object and v2 values for v2 object instead of having v2 values for v1 and v2 objects?
Thank you by advance
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Adding a new value to an existing ENUM Type - Stack Overflow
PostgreSQL 9.1 introduces ability to ALTER Enum types: ALTER TYPE enum_type ADD VALUE 'new_value'; -- appends to list ALTER TYPE enum_type ...
Read more >Updating Enum Values in PostgreSQL - The Safe and Easy Way
PSQL provides an easy way to add new values to an enum: ALTER TYPE name ADD VALUE ... . Version 10 introduced an...
Read more >Extending Enums in Java - Baeldung
In this tutorial, we'll discuss extending enums in Java, including adding new constant values and new functionalities.
Read more >More enum modification - Jazz.net
I have a seperate script that checks the value of the text attribute and modifies the enum accordingly - removes a "cp "...
Read more >Define Enum Fields and Suggested Values in the UI
Select Enums and Suggested Values, then select Suggested Values to make additional controls appear. From here, select Add row to start adding ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think you need
oneOf
oranyOf
(notallOf
) to combine the enums.Answered over a year ago, no further discussion, closing.