"Extending" objects using "allOf"
It often turns out that I need to modify examples in APIs when reusing objects defined in Domains. This I do by using the allOf: linking to the object using $ref and then modifying the example.
If I have an object called timestamp which contains a field called startDateTime with the value: 2000-01-01T00:00:00+00:00. I could modify the example by writing:
schemas:
timestamp:
type: object
allOf:
- $ref: 'https://api.swaggerhub.com/domains/.../components/schemas/timestamp'
- type: object
properties:
startDateTime:
example: 2019-11-12T07:41:00+08:30
SwaggerHub would then render the modified example-value in my timestamp - great!!
It is also possible to do the same thing when modifying the descriptions and/or adding deprecation, etc...
The problem comes when I want to modify an enum value. Here it seems that SwaggerHub "accumulates" all values instead of "replacing" them. So if I have a field called status (also on the timestamp object) with the enum values: STRT and END - and want to modify it by using above solution I would expect I could write:
schemas:
timestamp:
type: object
allOf:
- $ref: 'https://api.swaggerhub.com/domains/.../components/schemas/timestamp'
- type: object
properties:
status:
enum:
- START
- END
But what happens is that now Swaggerhub renderes 3 values: START, END and STRT (so an accumulation rather than a replacement).
Could someone from the Swagger team please verify that this is indeed the desired behavior? Or is this a bug?
If it is the desired behavior - then how do I reduce/modify an enumset in an already defined object?