Combine some definitions as filtered supersets
MODIFY
schemas/v3.0/README.md
schemas/v3.0/README.md
@@ -43,3 +43,6 @@ not:
- examples
```
+## Combine some definitions as filtered supersets
+
+With same pattern as for Parameter.
\ No newline at end of file

MODIFY
schemas/v3.0/schema.yaml
schemas/v3.0/schema.yaml
@@ -377,31 +377,11 @@ definitions:
additionalProperties: false
MediaType:
- oneOf:
- - $ref: '#/definitions/MediaTypeWithExample'
- - $ref: '#/definitions/MediaTypeWithExamples'
-
- MediaTypeWithExample:
type: object
properties:
schema:
$ref: '#/definitions/Schema'
example: {}
- encoding:
- type: object
- additionalProperties:
- $ref: '#/definitions/Encoding'
- patternProperties:
- '^x-': {}
- additionalProperties: false
-
- MediaTypeWithExamples:
- type: object
- required:
- - examples
- properties:
- schema:
- $ref: '#/definitions/Schema'
examples:
type: object
additionalProperties:
@@ -415,6 +395,9 @@ definitions:
patternProperties:
'^x-': {}
additionalProperties: false
+ not:
+ description: Example and examples are mutually exclusive
+ required: [example, examples]
Example:
type: object
@@ -432,19 +415,7 @@ definitions:
additionalProperties: false
Header:
- oneOf:
- - $ref: '#/definitions/HeaderWithSchema'
- - $ref: '#/definitions/HeaderWithContent'
-
- HeaderWithSchema:
- oneOf:
- - $ref: '#/definitions/HeaderWithSchemaWithExample'
- - $ref: '#/definitions/HeaderWithSchemaWithExamples'
-
- HeaderWithSchemaWithExample:
type: object
- required:
- - schema
properties:
description:
type: string
@@ -469,40 +440,13 @@ definitions:
default: false
schema:
$ref: '#/definitions/Schema'
- example: {}
- patternProperties:
- '^x-': {}
- additionalProperties: false
-
- HeaderWithSchemaWithExamples:
+ content:
type: object
- required:
- - schema
- - examples
- properties:
- description:
- type: string
- required:
- type: boolean
- default: false
- deprecated:
- type: boolean
- default: false
- allowEmptyValue:
- type: boolean
- default: false
- style:
- type: string
- enum:
- - simple
- default: simple
- explode:
- type: boolean
- allowReserved:
- type: boolean
- default: false
- schema:
- $ref: '#/definitions/Schema'
+ additionalProperties:
+ $ref: '#/definitions/MediaType'
+ minProperties: 1
+ maxProperties: 1
+ example: {}
examples:
type: object
additionalProperties:
@@ -512,32 +456,29 @@ definitions:
patternProperties:
'^x-': {}
additionalProperties: false
+ allOf:
+ - description: Example and examples are mutually exclusive
+ not:
+ required: [example, examples]
- HeaderWithContent:
- type: object
- required:
- - content
- properties:
- description:
- type: string
- required:
- type: boolean
- default: false
- deprecated:
- type: boolean
- default: false
- allowEmptyValue:
- type: boolean
- default: false
- content:
- type: object
- additionalProperties:
- $ref: '#/definitions/MediaType'
- minProperties: 1
- maxProperties: 1
- patternProperties:
- '^x-': {}
- additionalProperties: false
+ - description: Schema and content are mutually exclusive, at least one is required
+ not:
+ required: [schema, content]
+ oneOf:
+ - required: [schema]
+ - description: Content does not allow some properties
+ required: [content]
+ allOf:
+ - not:
+ required: [style]
+ - not:
+ required: [explode]
+ - not:
+ required: [allowReserved]
+ - not:
+ required: [example]
+ - not:
+ required: [examples]
Paths:
type: object
@@ -857,9 +798,37 @@ definitions:
additionalProperties: false
HTTPSecurityScheme:
+ type: object
+ required:
+ - scheme
+ - type
+ properties:
+ scheme:
+ type: string
+ bearerFormat:
+ type: string
+ description:
+ type: string
+ type:
+ type: string
+ enum:
+ - http
+ patternProperties:
+ '^x-': {}
+ additionalProperties: false
oneOf:
- - $ref: '#/definitions/NonBearerHTTPSecurityScheme'
- - $ref: '#/definitions/BearerHTTPSecurityScheme'
+ - description: Bearer
+ properties:
+ scheme:
+ enum: [bearer]
+
+ - description: Non Bearer
+ not:
+ required: [bearerFormat]
+ properties:
+ scheme:
+ not:
+ enum: [bearer]
NonBearerHTTPSecurityScheme:
type: object
@@ -1038,13 +1007,10 @@ definitions:
additionalProperties: false
Link:
- oneOf:
- - $ref: '#/definitions/LinkWithOperationRef'
- - $ref: '#/definitions/LinkWithOperationId'
-
- LinkWithOperationRef:
type: object
properties:
+ operationId:
+ type: string
operationRef:
type: string
format: uri-reference
@@ -1059,23 +1025,9 @@ definitions:
patternProperties:
'^x-': {}
additionalProperties: false
-
- LinkWithOperationId:
- type: object
- properties:
- operationId:
- type: string
- parameters:
- type: object
- additionalProperties: {}
- requestBody: {}
- description:
- type: string
- server:
- $ref: '#/definitions/Server'
- patternProperties:
- '^x-': {}
- additionalProperties: false
+ not:
+ description: Operation Id and Operation Ref are mutually exclusive
+ required: [operationId, operationRef]
Callback:
type: object

Combine some definitions as filtered supersets