api-elements.js icon indicating copy to clipboard operation
api-elements.js copied to clipboard

Error when `allOf` is used with contradictory `type`

Open kylef opened this issue 6 years ago • 2 comments
trafficstars

For example, the following schema is invalid and cannot be met:

allOf:
  - type: array
  - type: string

It is not possible to have a type that is both array and string. Thus we cannot create a data structure or valid message body.

kylef avatar Dec 07 '18 22:12 kylef

allOf is an openapi3 spec not openapi 2

anonkey avatar Nov 21 '19 10:11 anonkey

@anonkey allOf is available in OpenAPI 2, it's listed in spec for Schema Object (https://github.com/OAI/OpenAPI-Specification/blob/1d4e51ff5ad9a81fab656f5a50b220910ff62cf6/versions/2.0.md#schema-object), in particular this clause:

The following properties are taken from the JSON Schema definition but their definitions were adjusted to the Swagger Specification. Their definition is the same as the one from JSON Schema, only where the original definition references the JSON Schema definition, the Schema Object definition is used instead.

  • items
  • allOf
  • properties
  • additionalProperties

kylef avatar Nov 21 '19 11:11 kylef