Closed
Description
Hi, we're seeing the following test fail. Our environment is
- Python 3.11.6
- jsonschema 4.20.0
- jsonschema-specifications 2023.11.2
- rfc3339-validator 0.1.4
openapi-schema-validator> ______ TestOAS31ValidatorValidate.test_array_prefixitems_invalid[value0] _______
openapi-schema-validator>
openapi-schema-validator> self = <test_validators.TestOAS31ValidatorValidate object at 0x7ffff5d0f710>
openapi-schema-validator> validator_class = <class 'jsonschema.validators.create.<locals>.Validator'>
openapi-schema-validator> value = [1600, 'Pennsylvania', 'Avenue', 'NW', 'Washington']
openapi-schema-validator>
openapi-schema-validator> @pytest.mark.parametrize(
openapi-schema-validator> "value",
openapi-schema-validator> [
openapi-schema-validator> [1600, "Pennsylvania", "Avenue", "NW", "Washington"],
openapi-schema-validator> ],
openapi-schema-validator> )
openapi-schema-validator> def test_array_prefixitems_invalid(self, validator_class, value):
openapi-schema-validator> schema = {
openapi-schema-validator> "type": "array",
openapi-schema-validator> "prefixItems": [
openapi-schema-validator> {"type": "number"},
openapi-schema-validator> {"type": "string"},
openapi-schema-validator> {"enum": ["Street", "Avenue", "Boulevard"]},
openapi-schema-validator> {"enum": ["NW", "NE", "SW", "SE"]},
openapi-schema-validator> ],
openapi-schema-validator> "items": False,
openapi-schema-validator> }
openapi-schema-validator> validator = validator_class(
openapi-schema-validator> schema,
openapi-schema-validator> format_checker=oas31_format_checker,
openapi-schema-validator> )
openapi-schema-validator>
openapi-schema-validator> with pytest.raises(ValidationError) as excinfo:
openapi-schema-validator> validator.validate(value)
openapi-schema-validator>
openapi-schema-validator> error = "Expected at most 4 items, but found 5"
openapi-schema-validator> > assert error in str(excinfo.value)
openapi-schema-validator> E assert 'Expected at most 4 items, but found 5' in "Expected at most 4 items but found 1 extra: 'Washington'\n\nFailed validating 'items' in schema:\n {'items': False,\n 'prefixItems': [{'type': 'number'},\n {'type': 'string'},\n {'enum': ['Street', 'Avenue', 'Boulevard']},\n {'enum': ['NW', 'NE', 'SW', 'SE']}],\n 'type': 'array'}\n\nOn instance:\n [1600, 'Pennsylvania', 'Avenue', 'NW', 'Washington']"
openapi-schema-validator> E + where "Expected at most 4 items but found 1 extra: 'Washington'\n\nFailed validating 'items' in schema:\n {'items': False,\n 'prefixItems': [{'type': 'number'},\n {'type': 'string'},\n {'enum': ['Street', 'Avenue', 'Boulevard']},\n {'enum': ['NW', 'NE', 'SW', 'SE']}],\n 'type': 'array'}\n\nOn instance:\n [1600, 'Pennsylvania', 'Avenue', 'NW', 'Washington']" = str(<ValidationError: "Expected at most 4 items but found 1 extra: 'Washington'">)
openapi-schema-validator> E + where <ValidationError: "Expected at most 4 items but found 1 extra: 'Washington'"> = <ExceptionInfo <ValidationError: "Expected at most 4 items but found 1 extra: 'Washington'"> tblen=2>.value
openapi-schema-validator>
openapi-schema-validator> error = 'Expected at most 4 items, but found 5'
openapi-schema-validator> excinfo = <ExceptionInfo <ValidationError: "Expected at most 4 items but found 1 extra: 'Washington'"> tblen=2>
openapi-schema-validator> schema = {'items': False,
openapi-schema-validator> 'prefixItems': [{'type': 'number'},
openapi-schema-validator> {'type': 'string'},
openapi-schema-validator> {'enum': ['Street', 'Avenue', 'Boulevard']},
openapi-schema-validator> {'enum': ['NW', 'NE', 'SW', 'SE']}],
openapi-schema-validator> 'type': 'array'}
openapi-schema-validator> self = <test_validators.TestOAS31ValidatorValidate object at 0x7ffff5d0f710>
openapi-schema-validator> validator = Validator(schema={'items': False, 'prefixItems': [{'type': 'number'}, {'type': 'string'}, {'enum': ['Street', 'Avenue', 'Boulevard']}, {'enum': ['NW', 'NE', 'SW', 'SE']}], 'type': 'array'}, format_checker=<FormatChecker checkers=['date', 'date-time', 'double', 'email', 'float', 'idn-email', 'int32', 'int64', 'ipv4', 'ipv6', 'password', 'regex', 'time', 'uuid']>)
openapi-schema-validator> validator_class = <class 'jsonschema.validators.create.<locals>.Validator'>
openapi-schema-validator> value = [1600, 'Pennsylvania', 'Avenue', 'NW', 'Washington']
openapi-schema-validator>
openapi-schema-validator> tests/integration/test_validators.py:867: AssertionError
Metadata
Metadata
Assignees
Labels
No labels