Skip to content

Commit c7fc21c

Browse files
hlobitp1c2u
authored andcommitted
Add a failing test: default and $ref
1 parent 5521114 commit c7fc21c

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tests/integration/test_validators.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,48 @@ def test_parameter_default_value_wrong_type_swagger(self,
311311
assert errors_list[0].message == (
312312
"'invaldtype' is not of type 'integer'"
313313
)
314+
315+
def test_parameter_default_value_with_reference(self, validator):
316+
spec = {
317+
'openapi': '3.0.0',
318+
'info': {
319+
'title': 'Test Api',
320+
'version': '0.0.1',
321+
},
322+
'paths': {
323+
'/test/': {
324+
'get': {
325+
'responses': {
326+
'200': {
327+
'description': 'OK',
328+
'schema': {'type': 'object'},
329+
},
330+
},
331+
'parameters': [
332+
{
333+
'name': 'param1',
334+
'in': 'query',
335+
'schema': {
336+
'allOf':[{
337+
'$ref': '#/components/schemas/type',
338+
}],
339+
'default': 1,
340+
},
341+
},
342+
],
343+
},
344+
},
345+
},
346+
'components': {
347+
'schemas': {
348+
'type': {
349+
'type': 'integer',
350+
}
351+
},
352+
},
353+
}
354+
355+
errors = validator.iter_errors(spec)
356+
357+
errors_list = list(errors)
358+
assert errors_list == []

0 commit comments

Comments
 (0)