From 2d213ff578342762f0d86576bbe5f2e69047da76 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Thu, 24 May 2018 14:58:38 +0200 Subject: [PATCH 1/3] According to https://swagger.io/specification/#fixed-fields-51 towards the end of the section, a Parameter Object MUST contain either a 'schema' property or a 'content' property (but not both). --- .../resources/schemas/v3.0.0/schema.json | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/openapi_spec_validator/resources/schemas/v3.0.0/schema.json b/openapi_spec_validator/resources/schemas/v3.0.0/schema.json index b199631..11b7e0d 100644 --- a/openapi_spec_validator/resources/schemas/v3.0.0/schema.json +++ b/openapi_spec_validator/resources/schemas/v3.0.0/schema.json @@ -433,7 +433,15 @@ "content": { "$ref": "#/definitions/mediaTypes" } - } + }, + "oneOf": [ + { + "required": [ "schema" ] + }, + { + "required": [ "content" ] + } + ] }, "requestBody": { "type": "object", @@ -1250,4 +1258,4 @@ ] } } - } \ No newline at end of file + } From fec63944c7fc9416c06671137910ff96f49dc243 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Thu, 24 May 2018 15:17:13 +0200 Subject: [PATCH 2/3] Fix tests to deal with the requirement that parameter objects must contain one of 'content' or 'schema'. --- tests/integration/test_validators.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/integration/test_validators.py b/tests/integration/test_validators.py index a1e5acd..1eee91b 100644 --- a/tests/integration/test_validators.py +++ b/tests/integration/test_validators.py @@ -61,10 +61,16 @@ def test_same_parameters_names(self, validator): { 'name': 'param1', 'in': 'query', + 'schema': { + 'type': 'integer', + }, }, { 'name': 'param1', 'in': 'path', + 'schema': { + 'type': 'integer', + }, }, ], }, @@ -120,6 +126,9 @@ def test_undocumented_parameter(self, validator): { 'name': 'param1', 'in': 'path', + 'schema': { + 'type': 'integer', + }, }, ], }, From 1c25ece5bbbba31094e16255fc38727e92182eac Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Thu, 24 May 2018 15:25:28 +0200 Subject: [PATCH 3/3] Fix #25 for Header Objects --- .../resources/schemas/v3.0.0/schema.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openapi_spec_validator/resources/schemas/v3.0.0/schema.json b/openapi_spec_validator/resources/schemas/v3.0.0/schema.json index 11b7e0d..7b414d8 100644 --- a/openapi_spec_validator/resources/schemas/v3.0.0/schema.json +++ b/openapi_spec_validator/resources/schemas/v3.0.0/schema.json @@ -673,7 +673,15 @@ "content": { "$ref": "#/definitions/mediaTypes" } - } + }, + "oneOf": [ + { + "required": [ "schema" ] + }, + { + "required": [ "content" ] + } + ] }, "tag": { "type": "object",