Skip to content

Commit

Permalink
Add a failing test: default and $ref
Browse files Browse the repository at this point in the history
  • Loading branch information
hlobit committed Mar 25, 2020
1 parent b512034 commit 18d49c3
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/integration/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,48 @@ def test_parameter_default_value_wrong_type_swagger(self,
assert errors_list[0].message == (
"'invaldtype' is not of type 'integer'"
)

def test_parameter_default_value_with_reference(self, validator):
spec = {
'openapi': '3.0.0',
'info': {
'title': 'Test Api',
'version': '0.0.1',
},
'paths': {
'/test/': {
'get': {
'responses': {
'200': {
'description': 'OK',
'schema': {'type': 'object'},
},
},
'parameters': [
{
'name': 'param1',
'in': 'query',
'schema': {
'allOf':[{
'$ref': '#/components/schemas/type',
}],
'default': 1,
},
},
],
},
},
},
'components': {
'schemas': {
'type': {
'type': 'integer',
}
},
},
}

errors = validator.iter_errors(spec)

errors_list = list(errors)
assert errors_list == []

0 comments on commit 18d49c3

Please sign in to comment.