Skip to content

Commit 881a98a

Browse files
authored
Merge pull request #25 from jfinkhaeuser/openapi3-schema-fixes
OpenAPI 3.0.0 schema fix: Parameter Object must contain 'schema' or 'content'
2 parents fb39437 + 1c25ece commit 881a98a

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

openapi_spec_validator/resources/schemas/v3.0.0/schema.json

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,15 @@
433433
"content": {
434434
"$ref": "#/definitions/mediaTypes"
435435
}
436-
}
436+
},
437+
"oneOf": [
438+
{
439+
"required": [ "schema" ]
440+
},
441+
{
442+
"required": [ "content" ]
443+
}
444+
]
437445
},
438446
"requestBody": {
439447
"type": "object",
@@ -665,7 +673,15 @@
665673
"content": {
666674
"$ref": "#/definitions/mediaTypes"
667675
}
668-
}
676+
},
677+
"oneOf": [
678+
{
679+
"required": [ "schema" ]
680+
},
681+
{
682+
"required": [ "content" ]
683+
}
684+
]
669685
},
670686
"tag": {
671687
"type": "object",
@@ -1250,4 +1266,4 @@
12501266
]
12511267
}
12521268
}
1253-
}
1269+
}

tests/integration/test_validators.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,16 @@ def test_same_parameters_names(self, validator):
6161
{
6262
'name': 'param1',
6363
'in': 'query',
64+
'schema': {
65+
'type': 'integer',
66+
},
6467
},
6568
{
6669
'name': 'param1',
6770
'in': 'path',
71+
'schema': {
72+
'type': 'integer',
73+
},
6874
},
6975
],
7076
},
@@ -120,6 +126,9 @@ def test_undocumented_parameter(self, validator):
120126
{
121127
'name': 'param1',
122128
'in': 'path',
129+
'schema': {
130+
'type': 'integer',
131+
},
123132
},
124133
],
125134
},

0 commit comments

Comments
 (0)