From 578769bb270c41c80c1c57e93f23afc7c2b6c9a1 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Thu, 11 Apr 2019 13:12:53 -0700 Subject: [PATCH] rewrite more Reference oneOfs (for #1519) --- .../json-schema-validator/oas3-schema.yaml | 52 ++++++++++++++----- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/src/plugins/json-schema-validator/oas3-schema.yaml b/src/plugins/json-schema-validator/oas3-schema.yaml index ea6d71626b8..d1160039224 100644 --- a/src/plugins/json-schema-validator/oas3-schema.yaml +++ b/src/plugins/json-schema-validator/oas3-schema.yaml @@ -132,9 +132,16 @@ definitions: type: object patternProperties: "^[a-zA-Z0-9\\.\\-_]+$": - oneOf: - - $ref: "#/definitions/Schema" - - $ref: "#/definitions/Reference" + switch: + - if: + required: [$ref] + then: + $ref: "#/definitions/Reference" + - then: + $ref: "#/definitions/Schema" + # oneOf: + # - $ref: "#/definitions/Schema" + # - $ref: "#/definitions/Reference" responses: type: object patternProperties: @@ -296,9 +303,16 @@ definitions: properties: type: object additionalProperties: - oneOf: - - $ref: "#/definitions/Schema" - - $ref: "#/definitions/Reference" + switch: + - if: + required: [$ref] + then: + $ref: "#/definitions/Reference" + - then: + $ref: "#/definitions/Schema" + # oneOf: + # - $ref: "#/definitions/Schema" + # - $ref: "#/definitions/Reference" additionalProperties: oneOf: - $ref: "#/definitions/Schema" @@ -392,9 +406,16 @@ definitions: type: object properties: schema: - oneOf: - - $ref: "#/definitions/Schema" - - $ref: "#/definitions/Reference" + switch: + - if: + required: [$ref] + then: + $ref: "#/definitions/Reference" + - then: + $ref: "#/definitions/Schema" + # oneOf: + # - $ref: "#/definitions/Schema" + # - $ref: "#/definitions/Reference" example: {} examples: type: object @@ -538,9 +559,16 @@ definitions: # - $ref: "#/definitions/Reference" uniqueItems: true requestBody: - oneOf: - - $ref: "#/definitions/RequestBody" - - $ref: "#/definitions/Reference" + switch: + - if: + required: [$ref] + then: + $ref: "#/definitions/Reference" + - then: + $ref: "#/definitions/RequestBody" + # oneOf: + # - $ref: "#/definitions/RequestBody" + # - $ref: "#/definitions/Reference" responses: $ref: "#/definitions/Responses" callbacks: