Skip to content

Commit 3ff4521

Browse files
authored
Merge pull request #312 from sharkwouter/patch-1
Allow undefined required properties
2 parents 3ef6b37 + da26455 commit 3ff4521

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

openapi_spec_validator/validation/keywords.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def __call__(
144144
set(required) - set(properties) - set(nested_properties)
145145
)
146146
else:
147-
extra_properties = list(set(required) - set(properties))
147+
extra_properties = []
148148

149149
if extra_properties and require_properties:
150150
yield ExtraParametersError(

tests/integration/validation/test_exceptions.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def test_allow_allof_when_required_is_linked_to_the_parent_object(self):
202202
errors_list = list(errors)
203203
assert errors_list == []
204204

205-
def test_extra_parameters_in_required(self):
205+
def test_allow_extra_parameters_in_required(self):
206206
spec = {
207207
"openapi": "3.0.0",
208208
"info": {
@@ -225,10 +225,7 @@ def test_extra_parameters_in_required(self):
225225
errors = OpenAPIV30SpecValidator(spec).iter_errors()
226226

227227
errors_list = list(errors)
228-
assert errors_list[0].__class__ == ExtraParametersError
229-
assert errors_list[0].message == (
230-
"Required list has not defined properties: ['testparam1']"
231-
)
228+
assert len(errors_list) == 0
232229

233230
def test_undocumented_parameter(self):
234231
spec = {

0 commit comments

Comments
 (0)