diff --git a/src/plugins/json-schema-validator/oas3-schema.yaml b/src/plugins/json-schema-validator/oas3-schema.yaml index 3ecb02061b8..3d954346ffc 100644 --- a/src/plugins/json-schema-validator/oas3-schema.yaml +++ b/src/plugins/json-schema-validator/oas3-schema.yaml @@ -1,6 +1,7 @@ --- -id: '' -$schema: http://json-schema.org/draft-04/schema# +id: https://spec.openapis.org/oas/3.0/schema/2019-04-02 +"$schema": http://json-schema.org/draft-04/schema# +description: Validation schema for OpenAPI Specification 3.0.X. type: object required: - openapi @@ -26,6 +27,7 @@ properties: type: array items: $ref: "#/definitions/Tag" + uniqueItems: true paths: $ref: "#/definitions/Paths" components: @@ -131,8 +133,8 @@ definitions: patternProperties: "^[a-zA-Z0-9\\.\\-_]+$": oneOf: - - $ref: "#/definitions/Reference" - $ref: "#/definitions/Schema" + - $ref: "#/definitions/Reference" responses: type: object patternProperties: @@ -248,7 +250,7 @@ definitions: type: array items: {} minItems: 1 - uniqueItems: true + uniqueItems: false type: type: string enum: @@ -341,7 +343,7 @@ definitions: type: string namespace: type: string - format: url + format: uri prefix: type: string attribute: @@ -361,6 +363,7 @@ definitions: description: type: string headers: + type: object additionalProperties: oneOf: - $ref: "#/definitions/Header" @@ -379,10 +382,6 @@ definitions: "^x-": {} additionalProperties: false MediaType: - oneOf: - - $ref: "#/definitions/MediaTypeWithExample" - - $ref: "#/definitions/MediaTypeWithExamples" - MediaTypeWithExample: type: object properties: schema: @@ -390,22 +389,6 @@ definitions: - $ref: "#/definitions/Schema" - $ref: "#/definitions/Reference" example: {} - encoding: - type: object - additionalProperties: - $ref: "#/definitions/Encoding" - patternProperties: - "^x-": {} - additionalProperties: false - MediaTypeWithExamples: - type: object - required: - - examples - properties: - schema: - oneOf: - - $ref: "#/definitions/Schema" - - $ref: "#/definitions/Reference" examples: type: object additionalProperties: @@ -419,6 +402,8 @@ definitions: patternProperties: "^x-": {} additionalProperties: false + allOf: + - $ref: "#/definitions/ExampleXORExamples" Example: type: object properties: @@ -434,17 +419,7 @@ definitions: "^x-": {} 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 @@ -471,41 +446,13 @@ definitions: oneOf: - $ref: "#/definitions/Schema" - $ref: "#/definitions/Reference" + 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: - oneOf: - - $ref: "#/definitions/Schema" - - $ref: "#/definitions/Reference" examples: type: object additionalProperties: @@ -515,31 +462,9 @@ definitions: patternProperties: "^x-": {} additionalProperties: false - 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 + allOf: + - $ref: "#/definitions/ExampleXORExamples" + - $ref: "#/definitions/SchemaXORContent" Paths: type: object patternProperties: @@ -556,22 +481,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: @@ -582,7 +491,10 @@ definitions: oneOf: - $ref: "#/definitions/Parameter" - $ref: "#/definitions/Reference" + uniqueItems: true patternProperties: + "^(get|put|post|delete|options|head|patch|trace)$": + $ref: "#/definitions/Operation" "^x-": {} additionalProperties: false Operation: @@ -608,6 +520,7 @@ definitions: oneOf: - $ref: "#/definitions/Parameter" - $ref: "#/definitions/Reference" + uniqueItems: true requestBody: oneOf: - $ref: "#/definitions/RequestBody" @@ -642,18 +555,13 @@ definitions: - $ref: "#/definitions/Response" - $ref: "#/definitions/Reference" patternProperties: - "[1-5](?:\\d{2}|XX)": + "^[1-5](?:\\d{2}|XX)$": oneOf: - $ref: "#/definitions/Response" - $ref: "#/definitions/Reference" "^x-": {} minProperties: 1 additionalProperties: false - not: - type: object - patternProperties: - "^x-": {} - additionalProperties: false SecurityRequirement: type: object additionalProperties: @@ -687,40 +595,52 @@ definitions: patternProperties: "^x-": {} additionalProperties: false - Parameter: - oneOf: - - $ref: "#/definitions/ParameterWithSchema" - - $ref: "#/definitions/ParameterWithContent" - ParameterWithSchema: - oneOf: - - $ref: "#/definitions/ParameterWithSchemaWithExample" - - $ref: "#/definitions/ParameterWithSchemaWithExamples" - ParameterWithSchemaWithExample: + 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: - - $ref: "#/definitions/ParameterWithSchemaWithExampleInPath" - - $ref: "#/definitions/ParameterWithSchemaWithExampleInQuery" - - $ref: "#/definitions/ParameterWithSchemaWithExampleInHeader" - - $ref: "#/definitions/ParameterWithSchemaWithExampleInCookie" - ParameterWithSchemaWithExampleInPath: + - 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 - required: - - name - - in - - schema - - required properties: name: type: string in: type: string - enum: - - path description: type: string required: type: boolean - enum: - - true + default: false deprecated: type: boolean default: false @@ -729,11 +649,6 @@ definitions: default: false style: type: string - enum: - - matrix - - label - - simple - default: simple explode: type: boolean allowReserved: @@ -743,513 +658,159 @@ definitions: oneOf: - $ref: "#/definitions/Schema" - $ref: "#/definitions/Reference" + content: + type: object + additionalProperties: + $ref: "#/definitions/MediaType" + minProperties: 1 + maxProperties: 1 example: {} + examples: + type: object + additionalProperties: + oneOf: + - $ref: "#/definitions/Example" + - $ref: "#/definitions/Reference" patternProperties: "^x-": {} additionalProperties: false - ParameterWithSchemaWithExampleInQuery: - type: object required: - name - in - - schema + allOf: + - $ref: "#/definitions/ExampleXORExamples" + - $ref: "#/definitions/SchemaXORContent" + - $ref: "#/definitions/ParameterLocation" + 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: + - cookie + style: + enum: + - form + default: form + RequestBody: + type: object + required: + - content properties: - name: - type: string - in: - type: string - enum: - - query description: type: string + content: + type: object + additionalProperties: + $ref: "#/definitions/MediaType" 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: - oneOf: - - $ref: "#/definitions/Schema" - - $ref: "#/definitions/Reference" - example: {} patternProperties: "^x-": {} additionalProperties: false - ParameterWithSchemaWithExampleInHeader: + SecurityScheme: + oneOf: + - $ref: "#/definitions/APIKeySecurityScheme" + - $ref: "#/definitions/HTTPSecurityScheme" + - $ref: "#/definitions/OAuth2SecurityScheme" + - $ref: "#/definitions/OpenIdConnectSecurityScheme" + APIKeySecurityScheme: type: object required: + - type - name - in - - schema properties: + type: + type: string + enum: + - apiKey name: type: string in: type: string enum: - header + - query + - cookie 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: - oneOf: - - $ref: "#/definitions/Schema" - - $ref: "#/definitions/Reference" - example: {} patternProperties: "^x-": {} additionalProperties: false - ParameterWithSchemaWithExampleInCookie: + HTTPSecurityScheme: type: object required: - - name - - in - - schema + - scheme + - type properties: - name: + scheme: type: string - in: + bearerFormat: type: string - enum: - - cookie description: type: string - required: - type: boolean - default: false - deprecated: - type: boolean - default: false - allowEmptyValue: - type: boolean - default: false - style: + type: type: string enum: - - form - default: form - explode: - type: boolean - allowReserved: - type: boolean - default: false - schema: - oneOf: - - $ref: "#/definitions/Schema" - - $ref: "#/definitions/Reference" - example: {} + - http 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: - type: boolean - default: false - schema: - oneOf: - - $ref: "#/definitions/Schema" - - $ref: "#/definitions/Reference" - examples: - 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: - oneOf: - - $ref: "#/definitions/Schema" - - $ref: "#/definitions/Reference" - examples: - type: object - additionalProperties: - oneOf: - - $ref: "#/definitions/Example" - - $ref: "#/definitions/Reference" - 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: - oneOf: - - $ref: "#/definitions/Schema" - - $ref: "#/definitions/Reference" - examples: - type: object - additionalProperties: - oneOf: - - $ref: "#/definitions/Example" - - $ref: "#/definitions/Reference" - patternProperties: - "^x-": {} - additionalProperties: false - 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: - oneOf: - - $ref: "#/definitions/Schema" - - $ref: "#/definitions/Reference" - examples: - type: object - additionalProperties: - oneOf: - - $ref: "#/definitions/Example" - - $ref: "#/definitions/Reference" - patternProperties: - "^x-": {} - additionalProperties: false - 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 - 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 - RequestBody: - type: object - required: - - content - properties: - description: - type: string - content: - type: object - additionalProperties: - $ref: "#/definitions/MediaType" - required: - type: boolean - default: false - patternProperties: - "^x-": {} - additionalProperties: false - SecurityScheme: - oneOf: - - $ref: "#/definitions/APIKeySecurityScheme" - - $ref: "#/definitions/HTTPSecurityScheme" - - $ref: "#/definitions/OAuth2SecurityScheme" - - $ref: "#/definitions/OpenIdConnectSecurityScheme" - APIKeySecurityScheme: - type: object - required: - - type - - name - - in - properties: - type: - type: string - enum: - - apiKey - name: - type: string - in: - type: string - enum: - - header - - query - - cookie - description: - type: string - patternProperties: - "^x-": {} - additionalProperties: false - HTTPSecurityScheme: - oneOf: - - $ref: "#/definitions/NonBearerHTTPSecurityScheme" - - $ref: "#/definitions/BearerHTTPSecurityScheme" - NonBearerHTTPSecurityScheme: - not: - type: object + - description: Bearer properties: scheme: - type: string enum: - bearer - type: object - required: - - scheme - - type - properties: - scheme: - type: string - 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 + - description: Non Bearer + not: + required: + - bearerFormat + properties: + scheme: + not: + enum: + - bearer OAuth2SecurityScheme: type: object required: @@ -1279,7 +840,7 @@ definitions: - openIdConnect openIdConnectUrl: type: string - format: url + format: uri-reference description: type: string patternProperties: @@ -1377,12 +938,10 @@ definitions: "^x-": {} additionalProperties: false Link: - oneOf: - - $ref: "#/definitions/LinkWithOperationRef" - - $ref: "#/definitions/LinkWithOperationId" - LinkWithOperationRef: type: object properties: + operationId: + type: string operationRef: type: string format: uri-reference @@ -1397,22 +956,11 @@ 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 additionalProperties: @@ -1441,4 +989,3 @@ definitions: type: boolean default: false additionalProperties: false -