Forum Discussion

wfreitag's avatar
wfreitag
New Contributor
2 years ago

Usage of anyOf/oneOf/allOf

While following schema is valid in Open-API:

. . .
components
:
schemas:
MyModel:
description: One Model to rule them all.
properties:
id:
anyOf:
- description: Property. Identifier format of any NGSI entity
maxLength: 256
minLength: 1
pattern: ^[\w\-\.\{\}\$\+\*\[\]`|~^@!,:\\]+$
type: string
- description: Property. Identifier format of any NGSI entity
format: uri
type: string
description: Unique identifier of the entity
. . .

 

...the same definition is not valid against Swagger 2.0 (the editor complains about "anyOf" is an additional property and not allowed).

 

Structural error at definitions.MyModel.properties.id
should NOT have additional properties additionalProperty: anyOf

 

Why is that difference between Open-API and Swagger - why does Swagger not follow Open-API at that point?

No RepliesBe the first to reply