From 88dd4301d137a656aca2f20a25cd1b54032b5f05 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Tue, 8 Jan 2019 10:30:23 +0100 Subject: [PATCH 01/10] Pre-format schema to improve changes relevancy --- schemas/v3.0/schema.yaml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 90c72683d9..280b88e177 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -77,7 +77,7 @@ definitions: format: email patternProperties: '^x-': {} - additionalProperties: false + additionalProperties: false License: type: object @@ -327,8 +327,8 @@ definitions: $ref: '#/definitions/XML' patternProperties: '^x-': {} - additionalProperties: false - + additionalProperties: false + Discriminator: type: object required: @@ -407,7 +407,7 @@ definitions: $ref: '#/definitions/Encoding' patternProperties: '^x-': {} - additionalProperties: false + additionalProperties: false MediaTypeWithExamples: type: object @@ -430,7 +430,7 @@ definitions: $ref: '#/definitions/Encoding' patternProperties: '^x-': {} - additionalProperties: false + additionalProperties: false Example: type: object @@ -490,7 +490,7 @@ definitions: example: {} patternProperties: '^x-': {} - additionalProperties: false + additionalProperties: false HeaderWithSchemaWithExamples: type: object @@ -562,7 +562,7 @@ definitions: Paths: type: object patternProperties: - '^\/': + '^\/': $ref: '#/definitions/PathItem' '^x-': {} additionalProperties: false @@ -673,7 +673,7 @@ definitions: '^x-': {} minProperties: 1 additionalProperties: false - + SecurityRequirement: type: object @@ -715,7 +715,7 @@ definitions: oneOf: - $ref: '#/definitions/ParameterWithSchema' - $ref: '#/definitions/ParameterWithContent' - + ParameterWithSchema: oneOf: - $ref: '#/definitions/ParameterWithSchemaWithExample' @@ -819,7 +819,7 @@ definitions: example: {} patternProperties: '^x-': {} - additionalProperties: false + additionalProperties: false ParameterWithSchemaWithExampleInHeader: type: object @@ -862,7 +862,7 @@ definitions: example: {} patternProperties: '^x-': {} - additionalProperties: false + additionalProperties: false ParameterWithSchemaWithExampleInCookie: type: object @@ -905,7 +905,7 @@ definitions: example: {} patternProperties: '^x-': {} - additionalProperties: false + additionalProperties: false ParameterWithSchemaWithExamples: oneOf: @@ -1017,7 +1017,7 @@ definitions: - $ref: '#/definitions/Reference' patternProperties: '^x-': {} - additionalProperties: false + additionalProperties: false ParameterWithSchemaWithExamplesInHeader: type: object @@ -1066,7 +1066,7 @@ definitions: - $ref: '#/definitions/Reference' patternProperties: '^x-': {} - additionalProperties: false + additionalProperties: false ParameterWithSchemaWithExamplesInCookie: type: object @@ -1217,7 +1217,7 @@ definitions: - $ref: '#/definitions/HTTPSecurityScheme' - $ref: '#/definitions/OAuth2SecurityScheme' - $ref: '#/definitions/OpenIdConnectSecurityScheme' - + APIKeySecurityScheme: type: object required: @@ -1228,7 +1228,7 @@ definitions: type: type: string enum: - - apiKey + - apiKey name: type: string in: @@ -1242,7 +1242,7 @@ definitions: patternProperties: '^x-': {} additionalProperties: false - + HTTPSecurityScheme: oneOf: - $ref: '#/definitions/NonBearerHTTPSecurityScheme' @@ -1318,7 +1318,7 @@ definitions: type: type: string enum: - - openIdConnect + - openIdConnect openIdConnectUrl: type: string format: uri-reference From 26cf125ad3f25a1d983c7094299c91948502acd6 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Tue, 8 Jan 2019 11:02:46 +0100 Subject: [PATCH 02/10] Simplify Schema or Reference --- schemas/v3.0/README.md | 24 ++++++++++++ schemas/v3.0/schema.yaml | 80 +++++++++++----------------------------- 2 files changed, 46 insertions(+), 58 deletions(-) create mode 100644 schemas/v3.0/README.md diff --git a/schemas/v3.0/README.md b/schemas/v3.0/README.md new file mode 100644 index 0000000000..e38570a4c6 --- /dev/null +++ b/schemas/v3.0/README.md @@ -0,0 +1,24 @@ +# Minimizing schema + +## Schema or Reference + +All references to `#/definitions/Schema` are happening in such form: + +```yaml +oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Schema' +``` + +Therefore `#/definitions/Reference` can be merged into `#/definitions/Schema` to simplify usages: + +```yaml +$ref: '#/definitions/Schema' +``` + +Validation difference after this change is that additional unknown properties are no longer accepted for References. +Such data would become invalid: + +```json +{"$ref": "#", "unknown": 1} +``` diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 280b88e177..2fd59e2a97 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -134,9 +134,7 @@ definitions: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Schema' + $ref: '#/definitions/Schema' responses: type: object patternProperties: @@ -264,41 +262,28 @@ definitions: - object - string not: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' allOf: type: array items: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' oneOf: type: array items: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' anyOf: type: array items: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' items: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' properties: type: object additionalProperties: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' additionalProperties: oneOf: - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' - type: boolean default: true description: @@ -326,6 +311,9 @@ definitions: xml: $ref: '#/definitions/XML' patternProperties: + '^\$ref$': + type: string + format: uri-reference '^x-': {} additionalProperties: false @@ -397,9 +385,7 @@ definitions: type: object properties: schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' example: {} encoding: type: object @@ -415,9 +401,7 @@ definitions: - examples properties: schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' examples: type: object additionalProperties: @@ -484,9 +468,7 @@ definitions: type: boolean default: false schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' example: {} patternProperties: '^x-': {} @@ -520,9 +502,7 @@ definitions: type: boolean default: false schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' examples: type: object additionalProperties: @@ -767,9 +747,7 @@ definitions: type: boolean default: false schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' example: {} patternProperties: '^x-': {} @@ -813,9 +791,7 @@ definitions: type: boolean default: false schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' example: {} patternProperties: '^x-': {} @@ -856,9 +832,7 @@ definitions: type: boolean default: false schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' example: {} patternProperties: '^x-': {} @@ -899,9 +873,7 @@ definitions: type: boolean default: false schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' example: {} patternProperties: '^x-': {} @@ -954,9 +926,7 @@ definitions: type: boolean default: false schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' examples: type: object additionalProperties: @@ -1006,9 +976,7 @@ definitions: type: boolean default: false schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' examples: type: object additionalProperties: @@ -1055,9 +1023,7 @@ definitions: type: boolean default: false schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' examples: type: object additionalProperties: @@ -1104,9 +1070,7 @@ definitions: type: boolean default: false schema: - oneOf: - - $ref: '#/definitions/Schema' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Schema' examples: type: object additionalProperties: From bedcc1790b2838d8e23f035c25bba6e088dbdb59 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Tue, 8 Jan 2019 11:23:51 +0100 Subject: [PATCH 03/10] Combine HTTP Methods in `patternProperties` --- schemas/v3.0/README.md | 7 +++++++ schemas/v3.0/schema.yaml | 18 ++---------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/schemas/v3.0/README.md b/schemas/v3.0/README.md index e38570a4c6..14c97d0ab1 100644 --- a/schemas/v3.0/README.md +++ b/schemas/v3.0/README.md @@ -22,3 +22,10 @@ Such data would become invalid: ```json {"$ref": "#", "unknown": 1} ``` + +## Combine HTTP Methods in `patternProperties` + +```yaml +patternProperties: + '^(get|put|post|delete|options|head|patch|trace)$': $ref: '#/definitions/Operation' +``` diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 2fd59e2a97..f0be4d9d1c 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -556,22 +556,6 @@ definitions: type: string description: type: string - get: - $ref: '#/definitions/Operation' - put: - $ref: '#/definitions/Operation' - post: - $ref: '#/definitions/Operation' - delete: - $ref: '#/definitions/Operation' - options: - $ref: '#/definitions/Operation' - head: - $ref: '#/definitions/Operation' - patch: - $ref: '#/definitions/Operation' - trace: - $ref: '#/definitions/Operation' servers: type: array items: @@ -584,6 +568,8 @@ definitions: - $ref: '#/definitions/Reference' uniqueItems: true patternProperties: + '^(get|put|post|delete|options|head|patch|trace)$': + $ref: '#/definitions/Operation' '^x-': {} additionalProperties: false From 9592b1f9bd36bfbf3a6e85db6810db17913115d1 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Tue, 8 Jan 2019 12:20:05 +0100 Subject: [PATCH 04/10] Define Parameter as a filtered superset --- schemas/v3.0/README.md | 14 ++ schemas/v3.0/schema.yaml | 503 +++++++-------------------------------- 2 files changed, 97 insertions(+), 420 deletions(-) diff --git a/schemas/v3.0/README.md b/schemas/v3.0/README.md index 14c97d0ab1..7742c760c4 100644 --- a/schemas/v3.0/README.md +++ b/schemas/v3.0/README.md @@ -29,3 +29,17 @@ Such data would become invalid: patternProperties: '^(get|put|post|delete|options|head|patch|trace)$': $ref: '#/definitions/Operation' ``` + +## Define Parameter as a filtered superset + +In order to avoid massive duplication all possible properties can be defined in a superset. +Custom rules of exclusiveness can be further defined as a list of traits in `allOf`. + +For example such structure does not allow having `example` and `examples` in same object: +```yaml +not: + required: + - example + - examples +``` + diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index f0be4d9d1c..2387f52475 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -678,165 +678,12 @@ definitions: additionalProperties: false Parameter: - oneOf: - - $ref: '#/definitions/ParameterWithSchema' - - $ref: '#/definitions/ParameterWithContent' - - ParameterWithSchema: - oneOf: - - $ref: '#/definitions/ParameterWithSchemaWithExample' - - $ref: '#/definitions/ParameterWithSchemaWithExamples' - - ParameterWithSchemaWithExample: - oneOf: - - $ref: '#/definitions/ParameterWithSchemaWithExampleInPath' - - $ref: '#/definitions/ParameterWithSchemaWithExampleInQuery' - - $ref: '#/definitions/ParameterWithSchemaWithExampleInHeader' - - $ref: '#/definitions/ParameterWithSchemaWithExampleInCookie' - - ParameterWithSchemaWithExampleInPath: - type: object - required: - - name - - in - - schema - - required - properties: - name: - type: string - in: - type: string - enum: - - path - description: - type: string - required: - type: boolean - enum: - - true - deprecated: - type: boolean - default: false - allowEmptyValue: - type: boolean - default: false - style: - type: string - enum: - - matrix - - label - - simple - default: simple - explode: - type: boolean - allowReserved: - type: boolean - default: false - schema: - $ref: '#/definitions/Schema' - example: {} - patternProperties: - '^x-': {} - additionalProperties: false - - ParameterWithSchemaWithExampleInQuery: - type: object - required: - - name - - in - - schema - properties: - name: - type: string - in: - type: string - enum: - - query - description: - type: string - required: - type: boolean - default: false - deprecated: - type: boolean - default: false - allowEmptyValue: - type: boolean - default: false - style: - type: string - enum: - - form - - spaceDelimited - - pipeDelimited - - deepObject - default: form - explode: - type: boolean - allowReserved: - type: boolean - default: false - schema: - $ref: '#/definitions/Schema' - example: {} - patternProperties: - '^x-': {} - additionalProperties: false - - ParameterWithSchemaWithExampleInHeader: - type: object - required: - - name - - in - - schema - properties: - name: - type: string - in: - type: string - enum: - - header - 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' - example: {} - patternProperties: - '^x-': {} - additionalProperties: false - - ParameterWithSchemaWithExampleInCookie: type: object - required: - - name - - in - - schema properties: name: type: string in: type: string - enum: - - cookie description: type: string required: @@ -850,62 +697,6 @@ definitions: default: false style: type: string - enum: - - form - default: form - explode: - type: boolean - allowReserved: - type: boolean - default: false - schema: - $ref: '#/definitions/Schema' - example: {} - patternProperties: - '^x-': {} - additionalProperties: false - - ParameterWithSchemaWithExamples: - oneOf: - - $ref: '#/definitions/ParameterWithSchemaWithExamplesInPath' - - $ref: '#/definitions/ParameterWithSchemaWithExamplesInQuery' - - $ref: '#/definitions/ParameterWithSchemaWithExamplesInHeader' - - $ref: '#/definitions/ParameterWithSchemaWithExamplesInCookie' - - ParameterWithSchemaWithExamplesInPath: - type: object - required: - - name - - in - - schema - - required - - examples - properties: - name: - type: string - in: - type: string - enum: - - path - description: - type: string - required: - type: boolean - enum: - - true - deprecated: - type: boolean - default: false - allowEmptyValue: - type: boolean - default: false - style: - type: string - enum: - - matrix - - label - - simple - default: simple explode: type: boolean allowReserved: @@ -913,56 +704,13 @@ definitions: default: false schema: $ref: '#/definitions/Schema' - examples: + content: type: object additionalProperties: - oneOf: - - $ref: '#/definitions/Example' - - $ref: '#/definitions/Reference' - patternProperties: - '^x-': {} - additionalProperties: false - - ParameterWithSchemaWithExamplesInQuery: - type: object - required: - - name - - in - - schema - - examples - properties: - name: - type: string - in: - type: string - enum: - - query - description: - type: string - required: - type: boolean - default: false - deprecated: - type: boolean - default: false - allowEmptyValue: - type: boolean - default: false - style: - type: string - enum: - - form - - spaceDelimited - - pipeDelimited - - deepObject - default: form - explode: - type: boolean - allowReserved: - type: boolean - default: false - schema: - $ref: '#/definitions/Schema' + $ref: '#/definitions/MediaType' + minProperties: 1 + maxProperties: 1 + example: {} examples: type: object additionalProperties: @@ -972,176 +720,91 @@ definitions: patternProperties: '^x-': {} additionalProperties: false - - ParameterWithSchemaWithExamplesInHeader: - type: object required: - name - in - - schema - - examples - properties: - name: - type: string - in: - type: string - enum: - - header - 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' - examples: - type: object - additionalProperties: - oneOf: - - $ref: '#/definitions/Example' - - $ref: '#/definitions/Reference' - patternProperties: - '^x-': {} - additionalProperties: false + allOf: + - description: Example and examples are mutually exclusive + not: + required: + - example + - examples - ParameterWithSchemaWithExamplesInCookie: - type: object - required: - - name - - in - - schema - - examples - properties: - name: - type: string - in: - type: string - enum: - - cookie - description: - type: string - required: - type: boolean - default: false - deprecated: - type: boolean - default: false - allowEmptyValue: - type: boolean - default: false - style: - type: string - enum: - - form - default: form - explode: - type: boolean - allowReserved: - type: boolean - default: false - schema: - $ref: '#/definitions/Schema' - examples: - type: object - additionalProperties: - oneOf: - - $ref: '#/definitions/Example' - - $ref: '#/definitions/Reference' - patternProperties: - '^x-': {} - additionalProperties: false + - description: Schema and content are mutually exclusive, at least one is required + not: + required: [schema, content] + oneOf: + - required: [schema] + - required: [content] + description: Some properties are not allowed if content is present + allOf: + - not: + required: [style] + - not: + required: [explode] + - not: + required: [allowReserved] + - not: + required: [example] + - not: + required: [examples] - ParameterWithContent: - oneOf: - - $ref: '#/definitions/ParameterWithContentInPath' - - $ref: '#/definitions/ParameterWithContentNotInPath' - ParameterWithContentInPath: - type: object - required: - - name - - in - - content - properties: - name: - type: string - in: - type: string - enum: - - path - description: - type: string - required: - type: boolean - enum: - - true - 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: Parameter location + oneOf: + - description: Parameter in path + required: + - required + properties: + in: + enum: + - path + style: + enum: + - matrix + - label + - simple + default: simple + required: + enum: + - true - ParameterWithContentNotInPath: - type: object - required: - - name - - in - - content - properties: - name: - type: string - in: - type: string - enum: - - query - - header - - cookie - 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: Parameter in query + properties: + in: + enum: + - query + style: + enum: + - form + - spaceDelimited + - pipeDelimited + - deepObject + default: form + + + - description: Parameter in header + properties: + in: + enum: + - header + style: + enum: + - simple + default: simple + + + + - description: Parameter in cookie + properties: + in: + enum: + - header + style: + enum: + - form + default: form RequestBody: type: object From 81e3dd5a5de42aacbb8f7506068173d412b6a910 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Tue, 8 Jan 2019 13:08:19 +0100 Subject: [PATCH 05/10] Combine some definitions as filtered supersets --- schemas/v3.0/README.md | 3 + schemas/v3.0/schema.yaml | 180 ++++++++++++++------------------------- 2 files changed, 69 insertions(+), 114 deletions(-) diff --git a/schemas/v3.0/README.md b/schemas/v3.0/README.md index 7742c760c4..50201fbaf6 100644 --- a/schemas/v3.0/README.md +++ b/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 diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 2387f52475..06670ff1e9 100644 --- a/schemas/v3.0/schema.yaml +++ b/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' + content: + type: object + additionalProperties: + $ref: '#/definitions/MediaType' + minProperties: 1 + maxProperties: 1 example: {} - patternProperties: - '^x-': {} - additionalProperties: false - - HeaderWithSchemaWithExamples: - 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' 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 From cdd7816035a32c7ca9066fcdede2a247979062c1 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Tue, 8 Jan 2019 15:43:58 +0100 Subject: [PATCH 06/10] Move XOR logic to definitions, remove unused definition NonBearerHTTPSecurityScheme --- schemas/v3.0/schema.yaml | 212 +++++++++++++-------------------------- 1 file changed, 67 insertions(+), 145 deletions(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 06670ff1e9..3fa69f705c 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -395,9 +395,8 @@ definitions: patternProperties: '^x-': {} additionalProperties: false - not: - description: Example and examples are mutually exclusive - required: [example, examples] + allOf: + - $ref: '#/definitions/ExampleXORExamples' Example: type: object @@ -457,28 +456,8 @@ definitions: '^x-': {} additionalProperties: false allOf: - - description: Example and examples are mutually exclusive - not: - required: [example, examples] - - - 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] + - $ref: '#/definitions/ExampleXORExamples' + - $ref: '#/definitions/SchemaXORContent' Paths: type: object @@ -618,6 +597,31 @@ definitions: '^x-': {} additionalProperties: false + ExampleXORExamples: + description: Example and examples are mutually exclusive + not: + required: [example, examples] + + SchemaXORContent: + description: Schema and content are mutually exclusive, at least one is required + not: + required: [schema, content] + oneOf: + - required: [schema] + - required: [content] + description: Some properties are not allowed if content is present + allOf: + - not: + required: [style] + - not: + required: [explode] + - not: + required: [allowReserved] + - not: + required: [example] + - not: + required: [examples] + Parameter: type: object properties: @@ -665,87 +669,48 @@ definitions: - name - in allOf: - - description: Example and examples are mutually exclusive - not: - required: - - example - - examples - - - description: Schema and content are mutually exclusive, at least one is required - not: - required: [schema, content] - oneOf: - - required: [schema] - - required: [content] - description: Some properties are not allowed if content is present - allOf: - - not: - required: [style] - - not: - required: [explode] - - not: - required: [allowReserved] - - not: - required: [example] - - not: - required: [examples] - - - - description: Parameter location - oneOf: - - description: Parameter in path - required: - - required - properties: - in: - enum: - - path - style: - enum: - - matrix - - label - - simple - default: simple - required: - enum: - - true - + - $ref: '#/definitions/ExampleXORExamples' + - $ref: '#/definitions/SchemaXORContent' + - $ref: '#/definitions/ParameterLocation' - - description: Parameter in query - properties: - in: - enum: - - query - style: - enum: - - form - - spaceDelimited - - pipeDelimited - - deepObject - default: form - - - - description: Parameter in header - properties: - in: - enum: - - header - style: - enum: - - simple - default: simple + ParameterLocation: + description: Parameter location + oneOf: + - description: Parameter in path + required: + - required + properties: + in: + enum: [path] + style: + enum: [matrix, label, simple] + default: simple + required: + enum: [true] + - description: Parameter in query + properties: + in: + enum: [query] + style: + enum: [form, spaceDelimited, pipeDelimited, deepObject] + default: form + - description: Parameter in header + properties: + in: + enum: [header] + style: + enum: [simple] + default: simple - - description: Parameter in cookie - properties: - in: - enum: - - header - style: - enum: - - form - default: form + - description: Parameter in cookie + properties: + in: + enum: [cookie] + style: + enum: [form] + default: form RequestBody: type: object @@ -830,49 +795,6 @@ definitions: not: enum: [bearer] - NonBearerHTTPSecurityScheme: - type: object - required: - - scheme - - type - properties: - scheme: - type: string - not: - enum: - - bearer - description: - type: string - type: - type: string - enum: - - http - patternProperties: - '^x-': {} - additionalProperties: false - - BearerHTTPSecurityScheme: - type: object - required: - - type - - scheme - properties: - scheme: - type: string - enum: - - bearer - bearerFormat: - type: string - type: - type: string - enum: - - http - description: - type: string - patternProperties: - '^x-': {} - additionalProperties: false - OAuth2SecurityScheme: type: object required: From 2208e0876716e12483aebc2c5b8c3348f6613d0a Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Tue, 8 Jan 2019 13:28:27 +0100 Subject: [PATCH 07/10] Embed references --- schemas/v3.0/README.md | 7 ++- schemas/v3.0/schema.yaml | 105 ++++++++++++++++----------------------- 2 files changed, 50 insertions(+), 62 deletions(-) diff --git a/schemas/v3.0/README.md b/schemas/v3.0/README.md index 50201fbaf6..81a5d0abab 100644 --- a/schemas/v3.0/README.md +++ b/schemas/v3.0/README.md @@ -45,4 +45,9 @@ not: ## Combine some definitions as filtered supersets -With same pattern as for Parameter. \ No newline at end of file +With same pattern as for Parameter. + +## Embed references + +In order to simplify `oneOf` logic, many references can be embedded in respective definitions +(with same pattern as for Schema or Reference). \ No newline at end of file diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 3fa69f705c..63c101f2bf 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -32,14 +32,18 @@ patternProperties: '^x-': {} additionalProperties: false definitions: + RefProperty: + type: string + format: uri-reference + Reference: type: object required: - $ref patternProperties: '^\$ref$': - type: string - format: uri-reference + $ref: '#/definitions/RefProperty' + Info: type: object required: @@ -139,37 +143,27 @@ definitions: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Response' + $ref: '#/definitions/Response' parameters: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Parameter' + $ref: '#/definitions/Parameter' examples: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Example' + $ref: '#/definitions/Example' requestBodies: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/RequestBody' + $ref: '#/definitions/RequestBody' headers: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Header' + $ref: '#/definitions/Header' securitySchemes: type: object patternProperties: @@ -181,16 +175,12 @@ definitions: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Link' + $ref: '#/definitions/Link' callbacks: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Callback' + $ref: '#/definitions/Callback' patternProperties: '^x-': {} additionalProperties: false @@ -359,9 +349,7 @@ definitions: headers: type: object additionalProperties: - oneOf: - - $ref: '#/definitions/Header' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Header' content: type: object additionalProperties: @@ -369,10 +357,10 @@ definitions: links: type: object additionalProperties: - oneOf: - - $ref: '#/definitions/Link' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Link' patternProperties: + '^\$ref$': + $ref: '#/definitions/RefProperty' '^x-': {} additionalProperties: false @@ -385,9 +373,7 @@ definitions: examples: type: object additionalProperties: - oneOf: - - $ref: '#/definitions/Example' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Example' encoding: type: object additionalProperties: @@ -410,6 +396,8 @@ definitions: type: string format: uri-reference patternProperties: + '^\$ref$': + $ref: '#/definitions/RefProperty' '^x-': {} additionalProperties: false @@ -449,10 +437,10 @@ definitions: examples: type: object additionalProperties: - oneOf: - - $ref: '#/definitions/Example' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Example' patternProperties: + '^\$ref$': + $ref: '#/definitions/RefProperty' '^x-': {} additionalProperties: false allOf: @@ -483,9 +471,7 @@ definitions: parameters: type: array items: - oneOf: - - $ref: '#/definitions/Parameter' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Parameter' uniqueItems: true patternProperties: '^(get|put|post|delete|options|head|patch|trace)$': @@ -513,22 +499,16 @@ definitions: parameters: type: array items: - oneOf: - - $ref: '#/definitions/Parameter' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Parameter' uniqueItems: true requestBody: - oneOf: - - $ref: '#/definitions/RequestBody' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/RequestBody' responses: $ref: '#/definitions/Responses' callbacks: type: object additionalProperties: - oneOf: - - $ref: '#/definitions/Callback' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Callback' deprecated: type: boolean default: false @@ -548,14 +528,10 @@ definitions: type: object properties: default: - oneOf: - - $ref: '#/definitions/Response' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Response' patternProperties: '^[1-5](?:\d{2}|XX)$': - oneOf: - - $ref: '#/definitions/Response' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Response' '^x-': {} minProperties: 1 additionalProperties: false @@ -659,15 +635,15 @@ definitions: examples: type: object additionalProperties: - oneOf: - - $ref: '#/definitions/Example' - - $ref: '#/definitions/Reference' + $ref: '#/definitions/Example' patternProperties: + '^\$ref$': + $ref: '#/definitions/RefProperty' '^x-': {} additionalProperties: false - required: - - name - - in + oneOf: + - required: [$ref] + - required: [name, in] allOf: - $ref: '#/definitions/ExampleXORExamples' - $ref: '#/definitions/SchemaXORContent' @@ -714,8 +690,6 @@ definitions: RequestBody: type: object - required: - - content properties: description: type: string @@ -727,8 +701,13 @@ definitions: type: boolean default: false patternProperties: + '^\$ref$': + $ref: '#/definitions/RefProperty' '^x-': {} additionalProperties: false + oneOf: + - required: ["content"] + - required: ["$ref"] SecurityScheme: oneOf: @@ -945,6 +924,8 @@ definitions: server: $ref: '#/definitions/Server' patternProperties: + '^\$ref$': + $ref: '#/definitions/RefProperty' '^x-': {} additionalProperties: false not: @@ -956,6 +937,8 @@ definitions: additionalProperties: $ref: '#/definitions/PathItem' patternProperties: + '^\$ref$': + $ref: '#/definitions/RefProperty' '^x-': {} Encoding: From 3f09f4663d5e69bbe3b256667d9f245bf3a146c8 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Fri, 8 Mar 2019 12:53:56 +0100 Subject: [PATCH 08/10] Revert embed references as it flattens definition scopes and therefore affects `*Of`, `required` behavior --- schemas/v3.0/README.md | 7 +-- schemas/v3.0/schema.yaml | 105 +++++++++++++++++++++++---------------- 2 files changed, 62 insertions(+), 50 deletions(-) diff --git a/schemas/v3.0/README.md b/schemas/v3.0/README.md index 81a5d0abab..50201fbaf6 100644 --- a/schemas/v3.0/README.md +++ b/schemas/v3.0/README.md @@ -45,9 +45,4 @@ not: ## Combine some definitions as filtered supersets -With same pattern as for Parameter. - -## Embed references - -In order to simplify `oneOf` logic, many references can be embedded in respective definitions -(with same pattern as for Schema or Reference). \ No newline at end of file +With same pattern as for Parameter. \ No newline at end of file diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 63c101f2bf..3fa69f705c 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -32,18 +32,14 @@ patternProperties: '^x-': {} additionalProperties: false definitions: - RefProperty: - type: string - format: uri-reference - Reference: type: object required: - $ref patternProperties: '^\$ref$': - $ref: '#/definitions/RefProperty' - + type: string + format: uri-reference Info: type: object required: @@ -143,27 +139,37 @@ definitions: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - $ref: '#/definitions/Response' + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Response' parameters: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - $ref: '#/definitions/Parameter' + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Parameter' examples: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - $ref: '#/definitions/Example' + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Example' requestBodies: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - $ref: '#/definitions/RequestBody' + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/RequestBody' headers: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - $ref: '#/definitions/Header' + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Header' securitySchemes: type: object patternProperties: @@ -175,12 +181,16 @@ definitions: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - $ref: '#/definitions/Link' + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Link' callbacks: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - $ref: '#/definitions/Callback' + oneOf: + - $ref: '#/definitions/Reference' + - $ref: '#/definitions/Callback' patternProperties: '^x-': {} additionalProperties: false @@ -349,7 +359,9 @@ definitions: headers: type: object additionalProperties: - $ref: '#/definitions/Header' + oneOf: + - $ref: '#/definitions/Header' + - $ref: '#/definitions/Reference' content: type: object additionalProperties: @@ -357,10 +369,10 @@ definitions: links: type: object additionalProperties: - $ref: '#/definitions/Link' + oneOf: + - $ref: '#/definitions/Link' + - $ref: '#/definitions/Reference' patternProperties: - '^\$ref$': - $ref: '#/definitions/RefProperty' '^x-': {} additionalProperties: false @@ -373,7 +385,9 @@ definitions: examples: type: object additionalProperties: - $ref: '#/definitions/Example' + oneOf: + - $ref: '#/definitions/Example' + - $ref: '#/definitions/Reference' encoding: type: object additionalProperties: @@ -396,8 +410,6 @@ definitions: type: string format: uri-reference patternProperties: - '^\$ref$': - $ref: '#/definitions/RefProperty' '^x-': {} additionalProperties: false @@ -437,10 +449,10 @@ definitions: examples: type: object additionalProperties: - $ref: '#/definitions/Example' + oneOf: + - $ref: '#/definitions/Example' + - $ref: '#/definitions/Reference' patternProperties: - '^\$ref$': - $ref: '#/definitions/RefProperty' '^x-': {} additionalProperties: false allOf: @@ -471,7 +483,9 @@ definitions: parameters: type: array items: - $ref: '#/definitions/Parameter' + oneOf: + - $ref: '#/definitions/Parameter' + - $ref: '#/definitions/Reference' uniqueItems: true patternProperties: '^(get|put|post|delete|options|head|patch|trace)$': @@ -499,16 +513,22 @@ definitions: parameters: type: array items: - $ref: '#/definitions/Parameter' + oneOf: + - $ref: '#/definitions/Parameter' + - $ref: '#/definitions/Reference' uniqueItems: true requestBody: - $ref: '#/definitions/RequestBody' + oneOf: + - $ref: '#/definitions/RequestBody' + - $ref: '#/definitions/Reference' responses: $ref: '#/definitions/Responses' callbacks: type: object additionalProperties: - $ref: '#/definitions/Callback' + oneOf: + - $ref: '#/definitions/Callback' + - $ref: '#/definitions/Reference' deprecated: type: boolean default: false @@ -528,10 +548,14 @@ definitions: type: object properties: default: - $ref: '#/definitions/Response' + oneOf: + - $ref: '#/definitions/Response' + - $ref: '#/definitions/Reference' patternProperties: '^[1-5](?:\d{2}|XX)$': - $ref: '#/definitions/Response' + oneOf: + - $ref: '#/definitions/Response' + - $ref: '#/definitions/Reference' '^x-': {} minProperties: 1 additionalProperties: false @@ -635,15 +659,15 @@ definitions: examples: type: object additionalProperties: - $ref: '#/definitions/Example' + oneOf: + - $ref: '#/definitions/Example' + - $ref: '#/definitions/Reference' patternProperties: - '^\$ref$': - $ref: '#/definitions/RefProperty' '^x-': {} additionalProperties: false - oneOf: - - required: [$ref] - - required: [name, in] + required: + - name + - in allOf: - $ref: '#/definitions/ExampleXORExamples' - $ref: '#/definitions/SchemaXORContent' @@ -690,6 +714,8 @@ definitions: RequestBody: type: object + required: + - content properties: description: type: string @@ -701,13 +727,8 @@ definitions: type: boolean default: false patternProperties: - '^\$ref$': - $ref: '#/definitions/RefProperty' '^x-': {} additionalProperties: false - oneOf: - - required: ["content"] - - required: ["$ref"] SecurityScheme: oneOf: @@ -924,8 +945,6 @@ definitions: server: $ref: '#/definitions/Server' patternProperties: - '^\$ref$': - $ref: '#/definitions/RefProperty' '^x-': {} additionalProperties: false not: @@ -937,8 +956,6 @@ definitions: additionalProperties: $ref: '#/definitions/PathItem' patternProperties: - '^\$ref$': - $ref: '#/definitions/RefProperty' '^x-': {} Encoding: From 66659e4961ddf64323ec4350f286bf81bf7b544d Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Fri, 8 Mar 2019 12:54:19 +0100 Subject: [PATCH 09/10] Remove temporary README --- schemas/v3.0/README.md | 48 ------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 schemas/v3.0/README.md diff --git a/schemas/v3.0/README.md b/schemas/v3.0/README.md deleted file mode 100644 index 50201fbaf6..0000000000 --- a/schemas/v3.0/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Minimizing schema - -## Schema or Reference - -All references to `#/definitions/Schema` are happening in such form: - -```yaml -oneOf: - - $ref: '#/definitions/Reference' - - $ref: '#/definitions/Schema' -``` - -Therefore `#/definitions/Reference` can be merged into `#/definitions/Schema` to simplify usages: - -```yaml -$ref: '#/definitions/Schema' -``` - -Validation difference after this change is that additional unknown properties are no longer accepted for References. -Such data would become invalid: - -```json -{"$ref": "#", "unknown": 1} -``` - -## Combine HTTP Methods in `patternProperties` - -```yaml -patternProperties: - '^(get|put|post|delete|options|head|patch|trace)$': $ref: '#/definitions/Operation' -``` - -## Define Parameter as a filtered superset - -In order to avoid massive duplication all possible properties can be defined in a superset. -Custom rules of exclusiveness can be further defined as a list of traits in `allOf`. - -For example such structure does not allow having `example` and `examples` in same object: -```yaml -not: - required: - - example - - examples -``` - -## Combine some definitions as filtered supersets - -With same pattern as for Parameter. \ No newline at end of file From bbd49b68bc3950a6864195dc1664816efa0d4250 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Fri, 22 Mar 2019 08:40:18 +0100 Subject: [PATCH 10/10] Revert embedding $ref in Schema --- schemas/v3.0/schema.yaml | 44 ++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 3fa69f705c..1d6f8d20e1 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -134,7 +134,9 @@ definitions: type: object patternProperties: '^[a-zA-Z0-9\.\-_]+$': - $ref: '#/definitions/Schema' + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' responses: type: object patternProperties: @@ -262,28 +264,41 @@ definitions: - object - string not: - $ref: '#/definitions/Schema' + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' allOf: type: array items: - $ref: '#/definitions/Schema' + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' oneOf: type: array items: - $ref: '#/definitions/Schema' + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' anyOf: type: array items: - $ref: '#/definitions/Schema' + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' items: - $ref: '#/definitions/Schema' + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' properties: type: object additionalProperties: - $ref: '#/definitions/Schema' + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' additionalProperties: oneOf: - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' - type: boolean default: true description: @@ -311,9 +326,6 @@ definitions: xml: $ref: '#/definitions/XML' patternProperties: - '^\$ref$': - type: string - format: uri-reference '^x-': {} additionalProperties: false @@ -380,7 +392,9 @@ definitions: type: object properties: schema: - $ref: '#/definitions/Schema' + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' example: {} examples: type: object @@ -438,7 +452,9 @@ definitions: type: boolean default: false schema: - $ref: '#/definitions/Schema' + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' content: type: object additionalProperties: @@ -648,7 +664,9 @@ definitions: type: boolean default: false schema: - $ref: '#/definitions/Schema' + oneOf: + - $ref: '#/definitions/Schema' + - $ref: '#/definitions/Reference' content: type: object additionalProperties: