Forum Discussion
Here is a screenshot example for trying to "reduce" the set without luck 😞
In the above example I did "extend" the description and modify it to only contain valid values - but the enum is an accumulation of previous values and the ones in the red circle to the left 😞
Hi HenrikHL,
It is not possible to override/replace enum values in JSONSchema using allOf. Composition in this case (allOf + enum) should result in an intersection, because any instance must be valid against each of the subschemas. In other words, allOf can be used to reduce a "parent" schema's enum but not override it or extend it.
In your example, the enums do not have common values and this should result in an impossible schema that matches nothing. However there’s a bug in one of our Swagger-JS OSS components which is resulting in enum array merging.
I’ve raised an issue for this on the Swagger-JS GitHub repo. Thanks for raising this!
Cheers,
Frank
Related Content
Recent Discussions
- 24 hours ago
- 20 days ago