Contributions
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?1.3KViews0likes0CommentsanyOf together with type
Having a schema definition like: components: schemas: MySchema: properties: myProp: anyOf: - type: string format: uri - type: array items: type: string format: uri type: integer mySecondProp: ... In Swagger Editor, this is valid. In OpenAPI 3.0.0 I have found nothing about having both, 'type' (integer in the above sample) and 'anyOf' ('oneOf', 'allOf'). My interpretation is, that 'type' is ignored here. Is that correct? And if so, where do I find that "type is ignored if anyOf/oneOf/ is present" in the specification and if this is NOT correct, how do I handle this...what if the string cannot be evaluated to integer (what is obviously very likely)? So the final question: If a property has both, 'type' AND 'anyOf' ('oneOf'/'allOf'), which one wins?608Views0likes0Comments