==> Building on manectric ==> Checking for remote environment... ==> Syncing package to remote host... sending incremental file list ./ PKGBUILD 1,168 100% 0.00kB/s 0:00:00 1,168 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=1/3) python-openapi-schema-validator-0.6.0-1.log 208 100% 203.12kB/s 0:00:00 208 100% 203.12kB/s 0:00:00 (xfr#2, to-chk=0/3) sent 909 bytes received 69 bytes 1,956.00 bytes/sec total size is 1,364 speedup is 1.39 ==> Running extra-riscv64-build -- -d /home/felix/packages/riscv64-pkg-cache:/var/cache/pacman/pkg -l root6 on remote host... [?25l:: Synchronizing package databases... core downloading... extra downloading... :: Starting full system upgrade... resolving dependencies... looking for conflicting packages... Package (1) Old Version New Version Net Change Download Size core/systemd-libs 253.5-2 253.6-2 0.00 MiB 1.01 MiB Total Download Size: 1.01 MiB Total Installed Size: 2.26 MiB Net Upgrade Size: 0.00 MiB :: Proceed with installation? [Y/n] :: Retrieving packages... systemd-libs-253.6-2-riscv64 downloading... checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... upgrading systemd-libs... [?25h==> Building in chroot for [extra] (riscv64)... ==> Synchronizing chroot copy [/var/lib/archbuild/extra-riscv64/root] -> [root6]...done ==> Making package: python-openapi-schema-validator 0.6.0-1 (Wed Jul 12 10:54:12 2023) ==> Retrieving sources...  -> Downloading python-openapi-schema-validator-0.6.0.tar.gz... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 52700 0 52700 0 0 71587 0 --:--:-- --:--:-- --:--:-- 71587 ==> Validating source files with sha256sums... python-openapi-schema-validator-0.6.0.tar.gz ... Passed ==> Making package: python-openapi-schema-validator 0.6.0-1 (Wed Jul 12 10:54:21 2023) ==> Checking runtime dependencies... ==> Installing missing dependencies... [?25lresolving dependencies... looking for conflicting packages... Package (11) New Version Net Change Download Size core/libnsl 2.0.0-3 0.06 MiB extra/python-attrs 22.2.0-3 0.55 MiB extra/python-pyrsistent 0.19.3-3 0.63 MiB extra/python-referencing 0.29.1-1 0.38 MiB 0.06 MiB extra/python-rpds-py 0.8.8-1 0.49 MiB 0.21 MiB extra/python-six 1.16.0-8 0.12 MiB extra/python-typing_extensions 4.7.0-1 0.37 MiB core/python 3.11.3-2 107.17 MiB extra/python-jsonschema 4.17.3-3 1.33 MiB extra/python-jsonschema-specifications 2023.06.1-1 0.05 MiB 0.01 MiB extra/python-rfc3339-validator 0.1.4-4 0.01 MiB Total Download Size: 0.28 MiB Total Installed Size: 111.18 MiB :: Proceed with installation? [Y/n] :: Retrieving packages... python-rpds-py-0.8.8-1-riscv64 downloading... python-referencing-0.29.1-1-any downloading... python-jsonschema-specifications-2023.06.1-1-any downloading... checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... installing libnsl... installing python... Optional dependencies for python python-setuptools python-pip sqlite [installed] mpdecimal: for decimal xz: for lzma [installed] tk: for tkinter installing python-attrs... installing python-pyrsistent... installing python-typing_extensions... installing python-jsonschema... Optional dependencies for python-jsonschema python-isoduration: for duration format python-fqdn: for hostname format python-idna: for idn-hostname format python-jsonpointer: for json-pointer & relative-json-pointer format python-rfc3339-validator: for date-time format [pending] python-rfc3987: for iri, iri-reference, uri & uri-reference format python-uri-template: for uri-template format python-webcolors: for color format installing python-rpds-py... installing python-referencing... installing python-jsonschema-specifications... installing python-six... installing python-rfc3339-validator... [?25h==> Checking buildtime dependencies... ==> Installing missing dependencies... [?25lresolving dependencies... looking for conflicting packages... Package (9) New Version Net Change extra/python-iniconfig 2.0.0-4 0.04 MiB extra/python-lark-parser 1.1.5-4 1.29 MiB extra/python-packaging 23.1-1 0.47 MiB extra/python-pluggy 1.0.0-4 0.13 MiB extra/python-pyproject-hooks 1.0.0-5 0.09 MiB extra/python-build 0.10.0-4 0.68 MiB extra/python-installer 0.7.0-3 0.82 MiB extra/python-poetry-core 1.6.1-1 5.17 MiB extra/python-pytest 7.4.0-1 4.01 MiB Total Installed Size: 12.69 MiB :: Proceed with installation? [Y/n] checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... installing python-packaging... installing python-pyproject-hooks... installing python-build... Optional dependencies for python-build python-virtualenv: Use virtualenv for build isolation installing python-installer... installing python-lark-parser... Optional dependencies for python-lark-parser python-atomicwrites: for atomic_cache python-regex: for regex support python-js2py: for nearley support installing python-poetry-core... installing python-iniconfig... installing python-pluggy... installing python-pytest... [?25h==> Retrieving sources...  -> Found python-openapi-schema-validator-0.6.0.tar.gz ==> WARNING: Skipping all source file integrity checks. ==> Extracting sources...  -> Extracting python-openapi-schema-validator-0.6.0.tar.gz with bsdtar ==> Starting prepare()... ==> Starting build()... * Getting build dependencies for wheel... * Building wheel... Successfully built openapi_schema_validator-0.6.0-py3-none-any.whl ==> Starting check()... ============================= test session starts ============================== platform linux -- Python 3.11.3, pytest-7.4.0, pluggy-1.0.0 -- /usr/bin/python cachedir: .pytest_cache rootdir: /build/python-openapi-schema-validator/src/openapi-schema-validator-0.6.0 configfile: pyproject.toml collecting ... collected 134 items tests/integration/test_validators.py::TestOAS30ValidatorFormatChecker::test_required_checkers PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[int32-test] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[int32-True] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[int32-3.12] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[int32-value3] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[int64-test] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[int64-True] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[int64-3.12] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[int64-value7] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[float-test] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[float-3] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[float-True] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[float-value11] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[double-test] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[double-3] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[double-True] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[double-value15] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[password-3.12] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[password-True] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[password-3] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_formats_ignored[password-value19] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_number_float_and_double_valid[3-float] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_number_float_and_double_valid[3-double] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_number_float_and_double_valid[3.14-float] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_number_float_and_double_valid[3.14-double] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_number_float_and_double_valid[1.0-float] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_number_float_and_double_valid[1.0-double] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string[test] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_invalid[True] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_invalid[3] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_invalid[3.12] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_invalid[None] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_referencing FAILED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oas30_formats_ignored[binary-True] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oas30_formats_ignored[binary-3] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oas30_formats_ignored[binary-3.12] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oas30_formats_ignored[binary-value3] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oas30_formats_ignored[byte-True] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oas30_formats_ignored[byte-3] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oas30_formats_ignored[byte-3.12] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oas30_formats_ignored[byte-value7] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_disallow_binary[test] XFAIL tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_binary_valid[test] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_binary_invalid[test] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_binary_invalid[True] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_binary_invalid[3] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_binary_invalid[3.12] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_binary_invalid[None] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_null[boolean] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_null[array] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_null[integer] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_null[number] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_null[string] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable_untyped[True] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable_untyped[False] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable[boolean] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable[array] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable[integer] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable[number] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable[string] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable_enum_without_none PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable_enum_with_none PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_format_byte_valid[c3RyaW5n0] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_format_byte_valid[c3RyaW5n1] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_format_byte_invalid[string0] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_string_format_byte_invalid[string1] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_allof_required PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_required PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oneof_required PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oneof_discriminator[oneOf] FAILED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oneof_discriminator[anyOf] FAILED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oneof_discriminator[allOf] FAILED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable_ref[True] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable_ref[False] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable_schema_combos[True-oneOf-None is not valid under any of the given schemas] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable_schema_combos[True-anyOf-None is not valid under any of the given schemas] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable_schema_combos[True-allOf-None for not nullable] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable_schema_combos[False-oneOf-None is not valid under any of the given schemas] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable_schema_combos[False-anyOf-None is not valid under any of the given schemas] PASSED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_nullable_schema_combos[False-allOf-None for not nullable] PASSED tests/integration/test_validators.py::TestOAS30ReadWriteValidatorValidate::test_read_only PASSED tests/integration/test_validators.py::TestOAS30ReadWriteValidatorValidate::test_write_only PASSED tests/integration/test_validators.py::TestOAS30ReadWriteValidatorValidate::test_required_read_only PASSED tests/integration/test_validators.py::TestOAS30ReadWriteValidatorValidate::test_required_write_only PASSED tests/integration/test_validators.py::TestOAS31ValidatorFormatChecker::test_required_checkers PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[int32-test] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[int32-True] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[int32-3.12] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[int32-value3] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[int64-test] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[int64-True] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[int64-3.12] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[int64-value7] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[float-test] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[float-3] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[float-True] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[float-value11] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[double-test] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[double-3] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[double-True] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[double-value15] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[password-3.12] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[password-True] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[password-3] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_formats_ignored[password-value19] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_number_float_and_double_valid[3-float] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_number_float_and_double_valid[3-double] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_number_float_and_double_valid[3.14-float] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_number_float_and_double_valid[3.14-double] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_number_float_and_double_valid[1.0-float] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_number_float_and_double_valid[1.0-double] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_string[test] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_string_invalid[True] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_string_invalid[3] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_string_invalid[3.12] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_string_invalid[None] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_referencing FAILED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_string_disallow_binary[test] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_null[boolean] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_null[array] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_null[integer] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_null[number] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_null[string] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_nullable[boolean] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_nullable[array] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_nullable[integer] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_nullable[number] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_nullable[string] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_schema_validation PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_schema_ref PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_array_prefixitems[value0] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_array_prefixitems[value1] PASSED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_array_prefixitems_invalid[value0] PASSED tests/unit/test_shortcut.py::ValidateTest::test_validate_does_not_mutate_schema_adding_nullable_key PASSED =================================== FAILURES =================================== _________________ TestOAS30ValidatorValidate.test_referencing __________________ self = validator_class = .Validator'> def test_referencing(self, validator_class): name_schema = Resource.from_contents( { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "string", } ) age_schema = DRAFT202012.create_resource( { "type": "integer", "format": "int32", "minimum": 0, "maximum": 120, } ) birth_date_schema = Resource.from_contents( { "type": "string", "format": "date", }, default_specification=DRAFT202012, ) registry = Registry().with_resources( [ ("urn:name-schema", name_schema), ("urn:age-schema", age_schema), ("urn:birth-date-schema", birth_date_schema), ], ) schema = { "type": "object", "required": ["name"], "properties": { "name": {"$ref": "urn:name-schema"}, "age": {"$ref": "urn:age-schema"}, "birth-date": {"$ref": "urn:birth-date-schema"}, }, "additionalProperties": False, } > validator = validator_class(schema, registry=registry) E TypeError: create..Validator.__init__() got an unexpected keyword argument 'registry' age_schema = Resource(contents={'type': 'integer', 'format': 'int32', 'minimum': 0, 'maximum': 120}, _specification=) birth_date_schema = Resource(contents={'type': 'string', 'format': 'date'}, _specification=) name_schema = Resource(contents={'$schema': 'https://json-schema.org/draft/2020-12/schema', 'type': 'string'}, _specification=) registry = schema = {'additionalProperties': False, 'properties': {'age': {'$ref': 'urn:age-schema'}, 'birth-date': {'$ref': 'urn:birth-date-schema'}, 'name': {'$ref': 'urn:name-schema'}}, 'required': ['name'], 'type': 'object'} self = validator_class = .Validator'> tests/integration/test_validators.py:144: TypeError __________ TestOAS30ValidatorValidate.test_oneof_discriminator[oneOf] __________ self = validator_class = .Validator'> schema_type = 'oneOf' @pytest.mark.parametrize( "schema_type", [ "oneOf", "anyOf", "allOf", ], ) def test_oneof_discriminator(self, validator_class, schema_type): # We define a few components schemas components = { "MountainHiking": { "type": "object", "properties": { "discipline": { "type": "string", # we allow both the explicitely matched mountain_hiking discipline # and the implicitely matched MoutainHiking discipline "enum": ["mountain_hiking", "MountainHiking"], }, "length": { "type": "integer", }, }, "required": ["discipline", "length"], }, "AlpineClimbing": { "type": "object", "properties": { "discipline": { "type": "string", "enum": ["alpine_climbing"], }, "height": { "type": "integer", }, }, "required": ["discipline", "height"], }, "Route": { # defined later }, } components["Route"][schema_type] = [ {"$ref": "#/components/schemas/MountainHiking"}, {"$ref": "#/components/schemas/AlpineClimbing"}, ] # Add the compoments in a minimalis schema schema = { "$ref": "#/components/schemas/Route", "components": {"schemas": components}, } if schema_type != "allOf": # use jsonschema validator when no discriminator is defined validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="is not valid under any of the given schemas", ): validator.validate( {"something": "matching_none_of_the_schemas"} ) assert False if schema_type == "anyOf": # use jsonschema validator when no discriminator is defined validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="is not valid under any of the given schemas", ): validator.validate( {"something": "matching_none_of_the_schemas"} ) assert False discriminator = { "propertyName": "discipline", "mapping": { "mountain_hiking": "#/components/schemas/MountainHiking", "alpine_climbing": "#/components/schemas/AlpineClimbing", }, } schema["components"]["schemas"]["Route"][ "discriminator" ] = discriminator # Optional: check we return useful result when the schema is wrong validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="does not contain discriminating property" ): validator.validate({"something": "missing"}) assert False # Check we get a non-generic, somehow usable, error message when a discriminated schema is failing with pytest.raises( ValidationError, match="'bad_string' is not of type 'integer'" ): > validator.validate( {"discipline": "mountain_hiking", "length": "bad_string"} ) components = {'AlpineClimbing': {'properties': {'discipline': {'enum': ['alpine_climbing'], 'type': 'string'}, 'height': {'type': '...ipline'}, 'oneOf': [{'$ref': '#/components/schemas/MountainHiking'}, {'$ref': '#/components/schemas/AlpineClimbing'}]}} discriminator = {'mapping': {'alpine_climbing': '#/components/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'} schema = {'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'discipline': {'en...line'}, 'oneOf': [{'$ref': '#/components/schemas/MountainHiking'}, {'$ref': '#/components/schemas/AlpineClimbing'}]}}}} schema_type = 'oneOf' self = validator = Validator(schema={'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'...ime', 'double', 'email', 'float', 'idn-email', 'int32', 'int64', 'ipv4', 'ipv6', 'password', 'regex', 'time', 'uuid']>) validator_class = .Validator'> tests/integration/test_validators.py:463: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Validator(schema={'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'...ime', 'double', 'email', 'float', 'idn-email', 'int32', 'int64', 'ipv4', 'ipv6', 'password', 'regex', 'time', 'uuid']>) args = ({'discipline': 'mountain_hiking', 'length': 'bad_string'},), kwargs = {} error = def validate(self, *args, **kwargs): for error in self.iter_errors(*args, **kwargs): > raise error E jsonschema.exceptions.ValidationError: {'discipline': 'mountain_hiking', 'length': 'bad_string'} reference '#/components/schemas/MountainHiking' could not be resolved E E Failed validating 'oneOf' in schema: E {'discriminator': {'mapping': {'alpine_climbing': '#/components/schemas/AlpineClimbing', E 'mountain_hiking': '#/components/schemas/MountainHiking'}, E 'propertyName': 'discipline'}, E 'oneOf': [{'$ref': '#/components/schemas/MountainHiking'}, E {'$ref': '#/components/schemas/AlpineClimbing'}]} E E On instance: E {'discipline': 'mountain_hiking', 'length': 'bad_string'} args = ({'discipline': 'mountain_hiking', 'length': 'bad_string'},) error = kwargs = {} self = Validator(schema={'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'...ime', 'double', 'email', 'float', 'idn-email', 'int32', 'int64', 'ipv4', 'ipv6', 'password', 'regex', 'time', 'uuid']>) /usr/lib/python3.11/site-packages/jsonschema/validators.py:314: ValidationError During handling of the above exception, another exception occurred: self = validator_class = .Validator'> schema_type = 'oneOf' @pytest.mark.parametrize( "schema_type", [ "oneOf", "anyOf", "allOf", ], ) def test_oneof_discriminator(self, validator_class, schema_type): # We define a few components schemas components = { "MountainHiking": { "type": "object", "properties": { "discipline": { "type": "string", # we allow both the explicitely matched mountain_hiking discipline # and the implicitely matched MoutainHiking discipline "enum": ["mountain_hiking", "MountainHiking"], }, "length": { "type": "integer", }, }, "required": ["discipline", "length"], }, "AlpineClimbing": { "type": "object", "properties": { "discipline": { "type": "string", "enum": ["alpine_climbing"], }, "height": { "type": "integer", }, }, "required": ["discipline", "height"], }, "Route": { # defined later }, } components["Route"][schema_type] = [ {"$ref": "#/components/schemas/MountainHiking"}, {"$ref": "#/components/schemas/AlpineClimbing"}, ] # Add the compoments in a minimalis schema schema = { "$ref": "#/components/schemas/Route", "components": {"schemas": components}, } if schema_type != "allOf": # use jsonschema validator when no discriminator is defined validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="is not valid under any of the given schemas", ): validator.validate( {"something": "matching_none_of_the_schemas"} ) assert False if schema_type == "anyOf": # use jsonschema validator when no discriminator is defined validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="is not valid under any of the given schemas", ): validator.validate( {"something": "matching_none_of_the_schemas"} ) assert False discriminator = { "propertyName": "discipline", "mapping": { "mountain_hiking": "#/components/schemas/MountainHiking", "alpine_climbing": "#/components/schemas/AlpineClimbing", }, } schema["components"]["schemas"]["Route"][ "discriminator" ] = discriminator # Optional: check we return useful result when the schema is wrong validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="does not contain discriminating property" ): validator.validate({"something": "missing"}) assert False # Check we get a non-generic, somehow usable, error message when a discriminated schema is failing > with pytest.raises( ValidationError, match="'bad_string' is not of type 'integer'" ): E AssertionError: Regex pattern did not match. E Regex: "'bad_string' is not of type 'integer'" E Input: "{'discipline': 'mountain_hiking', 'length': 'bad_string'} reference '#/components/schemas/MountainHiking' could not be resolved\n\nFailed validating 'oneOf' in schema:\n {'discriminator': {'mapping': {'alpine_climbing': '#/components/schemas/AlpineClimbing',\n 'mountain_hiking': '#/components/schemas/MountainHiking'},\n 'propertyName': 'discipline'},\n 'oneOf': [{'$ref': '#/components/schemas/MountainHiking'},\n {'$ref': '#/components/schemas/AlpineClimbing'}]}\n\nOn instance:\n {'discipline': 'mountain_hiking', 'length': 'bad_string'}" components = {'AlpineClimbing': {'properties': {'discipline': {'enum': ['alpine_climbing'], 'type': 'string'}, 'height': {'type': '...ipline'}, 'oneOf': [{'$ref': '#/components/schemas/MountainHiking'}, {'$ref': '#/components/schemas/AlpineClimbing'}]}} discriminator = {'mapping': {'alpine_climbing': '#/components/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'} schema = {'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'discipline': {'en...line'}, 'oneOf': [{'$ref': '#/components/schemas/MountainHiking'}, {'$ref': '#/components/schemas/AlpineClimbing'}]}}}} schema_type = 'oneOf' self = validator = Validator(schema={'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'...ime', 'double', 'email', 'float', 'idn-email', 'int32', 'int64', 'ipv4', 'ipv6', 'password', 'regex', 'time', 'uuid']>) validator_class = .Validator'> tests/integration/test_validators.py:460: AssertionError __________ TestOAS30ValidatorValidate.test_oneof_discriminator[anyOf] __________ self = validator_class = .Validator'> schema_type = 'anyOf' @pytest.mark.parametrize( "schema_type", [ "oneOf", "anyOf", "allOf", ], ) def test_oneof_discriminator(self, validator_class, schema_type): # We define a few components schemas components = { "MountainHiking": { "type": "object", "properties": { "discipline": { "type": "string", # we allow both the explicitely matched mountain_hiking discipline # and the implicitely matched MoutainHiking discipline "enum": ["mountain_hiking", "MountainHiking"], }, "length": { "type": "integer", }, }, "required": ["discipline", "length"], }, "AlpineClimbing": { "type": "object", "properties": { "discipline": { "type": "string", "enum": ["alpine_climbing"], }, "height": { "type": "integer", }, }, "required": ["discipline", "height"], }, "Route": { # defined later }, } components["Route"][schema_type] = [ {"$ref": "#/components/schemas/MountainHiking"}, {"$ref": "#/components/schemas/AlpineClimbing"}, ] # Add the compoments in a minimalis schema schema = { "$ref": "#/components/schemas/Route", "components": {"schemas": components}, } if schema_type != "allOf": # use jsonschema validator when no discriminator is defined validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="is not valid under any of the given schemas", ): validator.validate( {"something": "matching_none_of_the_schemas"} ) assert False if schema_type == "anyOf": # use jsonschema validator when no discriminator is defined validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="is not valid under any of the given schemas", ): validator.validate( {"something": "matching_none_of_the_schemas"} ) assert False discriminator = { "propertyName": "discipline", "mapping": { "mountain_hiking": "#/components/schemas/MountainHiking", "alpine_climbing": "#/components/schemas/AlpineClimbing", }, } schema["components"]["schemas"]["Route"][ "discriminator" ] = discriminator # Optional: check we return useful result when the schema is wrong validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="does not contain discriminating property" ): validator.validate({"something": "missing"}) assert False # Check we get a non-generic, somehow usable, error message when a discriminated schema is failing with pytest.raises( ValidationError, match="'bad_string' is not of type 'integer'" ): > validator.validate( {"discipline": "mountain_hiking", "length": "bad_string"} ) components = {'AlpineClimbing': {'properties': {'discipline': {'enum': ['alpine_climbing'], 'type': 'string'}, 'height': {'type': '...nts/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'}}} discriminator = {'mapping': {'alpine_climbing': '#/components/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'} schema = {'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'discipline': {'en...s/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'}}}}} schema_type = 'anyOf' self = validator = Validator(schema={'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'...ime', 'double', 'email', 'float', 'idn-email', 'int32', 'int64', 'ipv4', 'ipv6', 'password', 'regex', 'time', 'uuid']>) validator_class = .Validator'> tests/integration/test_validators.py:463: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Validator(schema={'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'...ime', 'double', 'email', 'float', 'idn-email', 'int32', 'int64', 'ipv4', 'ipv6', 'password', 'regex', 'time', 'uuid']>) args = ({'discipline': 'mountain_hiking', 'length': 'bad_string'},), kwargs = {} error = def validate(self, *args, **kwargs): for error in self.iter_errors(*args, **kwargs): > raise error E jsonschema.exceptions.ValidationError: {'discipline': 'mountain_hiking', 'length': 'bad_string'} reference '#/components/schemas/MountainHiking' could not be resolved E E Failed validating 'anyOf' in schema: E {'anyOf': [{'$ref': '#/components/schemas/MountainHiking'}, E {'$ref': '#/components/schemas/AlpineClimbing'}], E 'discriminator': {'mapping': {'alpine_climbing': '#/components/schemas/AlpineClimbing', E 'mountain_hiking': '#/components/schemas/MountainHiking'}, E 'propertyName': 'discipline'}} E E On instance: E {'discipline': 'mountain_hiking', 'length': 'bad_string'} args = ({'discipline': 'mountain_hiking', 'length': 'bad_string'},) error = kwargs = {} self = Validator(schema={'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'...ime', 'double', 'email', 'float', 'idn-email', 'int32', 'int64', 'ipv4', 'ipv6', 'password', 'regex', 'time', 'uuid']>) /usr/lib/python3.11/site-packages/jsonschema/validators.py:314: ValidationError During handling of the above exception, another exception occurred: self = validator_class = .Validator'> schema_type = 'anyOf' @pytest.mark.parametrize( "schema_type", [ "oneOf", "anyOf", "allOf", ], ) def test_oneof_discriminator(self, validator_class, schema_type): # We define a few components schemas components = { "MountainHiking": { "type": "object", "properties": { "discipline": { "type": "string", # we allow both the explicitely matched mountain_hiking discipline # and the implicitely matched MoutainHiking discipline "enum": ["mountain_hiking", "MountainHiking"], }, "length": { "type": "integer", }, }, "required": ["discipline", "length"], }, "AlpineClimbing": { "type": "object", "properties": { "discipline": { "type": "string", "enum": ["alpine_climbing"], }, "height": { "type": "integer", }, }, "required": ["discipline", "height"], }, "Route": { # defined later }, } components["Route"][schema_type] = [ {"$ref": "#/components/schemas/MountainHiking"}, {"$ref": "#/components/schemas/AlpineClimbing"}, ] # Add the compoments in a minimalis schema schema = { "$ref": "#/components/schemas/Route", "components": {"schemas": components}, } if schema_type != "allOf": # use jsonschema validator when no discriminator is defined validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="is not valid under any of the given schemas", ): validator.validate( {"something": "matching_none_of_the_schemas"} ) assert False if schema_type == "anyOf": # use jsonschema validator when no discriminator is defined validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="is not valid under any of the given schemas", ): validator.validate( {"something": "matching_none_of_the_schemas"} ) assert False discriminator = { "propertyName": "discipline", "mapping": { "mountain_hiking": "#/components/schemas/MountainHiking", "alpine_climbing": "#/components/schemas/AlpineClimbing", }, } schema["components"]["schemas"]["Route"][ "discriminator" ] = discriminator # Optional: check we return useful result when the schema is wrong validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="does not contain discriminating property" ): validator.validate({"something": "missing"}) assert False # Check we get a non-generic, somehow usable, error message when a discriminated schema is failing > with pytest.raises( ValidationError, match="'bad_string' is not of type 'integer'" ): E AssertionError: Regex pattern did not match. E Regex: "'bad_string' is not of type 'integer'" E Input: "{'discipline': 'mountain_hiking', 'length': 'bad_string'} reference '#/components/schemas/MountainHiking' could not be resolved\n\nFailed validating 'anyOf' in schema:\n {'anyOf': [{'$ref': '#/components/schemas/MountainHiking'},\n {'$ref': '#/components/schemas/AlpineClimbing'}],\n 'discriminator': {'mapping': {'alpine_climbing': '#/components/schemas/AlpineClimbing',\n 'mountain_hiking': '#/components/schemas/MountainHiking'},\n 'propertyName': 'discipline'}}\n\nOn instance:\n {'discipline': 'mountain_hiking', 'length': 'bad_string'}" components = {'AlpineClimbing': {'properties': {'discipline': {'enum': ['alpine_climbing'], 'type': 'string'}, 'height': {'type': '...nts/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'}}} discriminator = {'mapping': {'alpine_climbing': '#/components/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'} schema = {'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'discipline': {'en...s/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'}}}}} schema_type = 'anyOf' self = validator = Validator(schema={'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'...ime', 'double', 'email', 'float', 'idn-email', 'int32', 'int64', 'ipv4', 'ipv6', 'password', 'regex', 'time', 'uuid']>) validator_class = .Validator'> tests/integration/test_validators.py:460: AssertionError __________ TestOAS30ValidatorValidate.test_oneof_discriminator[allOf] __________ self = validator_class = .Validator'> schema_type = 'allOf' @pytest.mark.parametrize( "schema_type", [ "oneOf", "anyOf", "allOf", ], ) def test_oneof_discriminator(self, validator_class, schema_type): # We define a few components schemas components = { "MountainHiking": { "type": "object", "properties": { "discipline": { "type": "string", # we allow both the explicitely matched mountain_hiking discipline # and the implicitely matched MoutainHiking discipline "enum": ["mountain_hiking", "MountainHiking"], }, "length": { "type": "integer", }, }, "required": ["discipline", "length"], }, "AlpineClimbing": { "type": "object", "properties": { "discipline": { "type": "string", "enum": ["alpine_climbing"], }, "height": { "type": "integer", }, }, "required": ["discipline", "height"], }, "Route": { # defined later }, } components["Route"][schema_type] = [ {"$ref": "#/components/schemas/MountainHiking"}, {"$ref": "#/components/schemas/AlpineClimbing"}, ] # Add the compoments in a minimalis schema schema = { "$ref": "#/components/schemas/Route", "components": {"schemas": components}, } if schema_type != "allOf": # use jsonschema validator when no discriminator is defined validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="is not valid under any of the given schemas", ): validator.validate( {"something": "matching_none_of_the_schemas"} ) assert False if schema_type == "anyOf": # use jsonschema validator when no discriminator is defined validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="is not valid under any of the given schemas", ): validator.validate( {"something": "matching_none_of_the_schemas"} ) assert False discriminator = { "propertyName": "discipline", "mapping": { "mountain_hiking": "#/components/schemas/MountainHiking", "alpine_climbing": "#/components/schemas/AlpineClimbing", }, } schema["components"]["schemas"]["Route"][ "discriminator" ] = discriminator # Optional: check we return useful result when the schema is wrong validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="does not contain discriminating property" ): validator.validate({"something": "missing"}) assert False # Check we get a non-generic, somehow usable, error message when a discriminated schema is failing with pytest.raises( ValidationError, match="'bad_string' is not of type 'integer'" ): > validator.validate( {"discipline": "mountain_hiking", "length": "bad_string"} ) components = {'AlpineClimbing': {'properties': {'discipline': {'enum': ['alpine_climbing'], 'type': 'string'}, 'height': {'type': '...nts/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'}}} discriminator = {'mapping': {'alpine_climbing': '#/components/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'} schema = {'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'discipline': {'en...s/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'}}}}} schema_type = 'allOf' self = validator = Validator(schema={'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'...ime', 'double', 'email', 'float', 'idn-email', 'int32', 'int64', 'ipv4', 'ipv6', 'password', 'regex', 'time', 'uuid']>) validator_class = .Validator'> tests/integration/test_validators.py:463: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Validator(schema={'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'...ime', 'double', 'email', 'float', 'idn-email', 'int32', 'int64', 'ipv4', 'ipv6', 'password', 'regex', 'time', 'uuid']>) args = ({'discipline': 'mountain_hiking', 'length': 'bad_string'},), kwargs = {} error = def validate(self, *args, **kwargs): for error in self.iter_errors(*args, **kwargs): > raise error E jsonschema.exceptions.ValidationError: {'discipline': 'mountain_hiking', 'length': 'bad_string'} reference '#/components/schemas/MountainHiking' could not be resolved E E Failed validating 'allOf' in schema: E {'allOf': [{'$ref': '#/components/schemas/MountainHiking'}, E {'$ref': '#/components/schemas/AlpineClimbing'}], E 'discriminator': {'mapping': {'alpine_climbing': '#/components/schemas/AlpineClimbing', E 'mountain_hiking': '#/components/schemas/MountainHiking'}, E 'propertyName': 'discipline'}} E E On instance: E {'discipline': 'mountain_hiking', 'length': 'bad_string'} args = ({'discipline': 'mountain_hiking', 'length': 'bad_string'},) error = kwargs = {} self = Validator(schema={'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'...ime', 'double', 'email', 'float', 'idn-email', 'int32', 'int64', 'ipv4', 'ipv6', 'password', 'regex', 'time', 'uuid']>) /usr/lib/python3.11/site-packages/jsonschema/validators.py:314: ValidationError During handling of the above exception, another exception occurred: self = validator_class = .Validator'> schema_type = 'allOf' @pytest.mark.parametrize( "schema_type", [ "oneOf", "anyOf", "allOf", ], ) def test_oneof_discriminator(self, validator_class, schema_type): # We define a few components schemas components = { "MountainHiking": { "type": "object", "properties": { "discipline": { "type": "string", # we allow both the explicitely matched mountain_hiking discipline # and the implicitely matched MoutainHiking discipline "enum": ["mountain_hiking", "MountainHiking"], }, "length": { "type": "integer", }, }, "required": ["discipline", "length"], }, "AlpineClimbing": { "type": "object", "properties": { "discipline": { "type": "string", "enum": ["alpine_climbing"], }, "height": { "type": "integer", }, }, "required": ["discipline", "height"], }, "Route": { # defined later }, } components["Route"][schema_type] = [ {"$ref": "#/components/schemas/MountainHiking"}, {"$ref": "#/components/schemas/AlpineClimbing"}, ] # Add the compoments in a minimalis schema schema = { "$ref": "#/components/schemas/Route", "components": {"schemas": components}, } if schema_type != "allOf": # use jsonschema validator when no discriminator is defined validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="is not valid under any of the given schemas", ): validator.validate( {"something": "matching_none_of_the_schemas"} ) assert False if schema_type == "anyOf": # use jsonschema validator when no discriminator is defined validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="is not valid under any of the given schemas", ): validator.validate( {"something": "matching_none_of_the_schemas"} ) assert False discriminator = { "propertyName": "discipline", "mapping": { "mountain_hiking": "#/components/schemas/MountainHiking", "alpine_climbing": "#/components/schemas/AlpineClimbing", }, } schema["components"]["schemas"]["Route"][ "discriminator" ] = discriminator # Optional: check we return useful result when the schema is wrong validator = validator_class( schema, format_checker=oas30_format_checker ) with pytest.raises( ValidationError, match="does not contain discriminating property" ): validator.validate({"something": "missing"}) assert False # Check we get a non-generic, somehow usable, error message when a discriminated schema is failing > with pytest.raises( ValidationError, match="'bad_string' is not of type 'integer'" ): E AssertionError: Regex pattern did not match. E Regex: "'bad_string' is not of type 'integer'" E Input: "{'discipline': 'mountain_hiking', 'length': 'bad_string'} reference '#/components/schemas/MountainHiking' could not be resolved\n\nFailed validating 'allOf' in schema:\n {'allOf': [{'$ref': '#/components/schemas/MountainHiking'},\n {'$ref': '#/components/schemas/AlpineClimbing'}],\n 'discriminator': {'mapping': {'alpine_climbing': '#/components/schemas/AlpineClimbing',\n 'mountain_hiking': '#/components/schemas/MountainHiking'},\n 'propertyName': 'discipline'}}\n\nOn instance:\n {'discipline': 'mountain_hiking', 'length': 'bad_string'}" components = {'AlpineClimbing': {'properties': {'discipline': {'enum': ['alpine_climbing'], 'type': 'string'}, 'height': {'type': '...nts/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'}}} discriminator = {'mapping': {'alpine_climbing': '#/components/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'} schema = {'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'discipline': {'en...s/schemas/AlpineClimbing', 'mountain_hiking': '#/components/schemas/MountainHiking'}, 'propertyName': 'discipline'}}}}} schema_type = 'allOf' self = validator = Validator(schema={'$ref': '#/components/schemas/Route', 'components': {'schemas': {'AlpineClimbing': {'properties': {'...ime', 'double', 'email', 'float', 'idn-email', 'int32', 'int64', 'ipv4', 'ipv6', 'password', 'regex', 'time', 'uuid']>) validator_class = .Validator'> tests/integration/test_validators.py:460: AssertionError _________________ TestOAS31ValidatorValidate.test_referencing __________________ self = validator_class = .Validator'> def test_referencing(self, validator_class): name_schema = Resource.from_contents( { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "string", } ) age_schema = DRAFT202012.create_resource( { "type": "integer", "format": "int32", "minimum": 0, "maximum": 120, } ) birth_date_schema = Resource.from_contents( { "type": "string", "format": "date", }, default_specification=DRAFT202012, ) registry = Registry().with_resources( [ ("urn:name-schema", name_schema), ("urn:age-schema", age_schema), ("urn:birth-date-schema", birth_date_schema), ], ) schema = { "type": "object", "required": ["name"], "properties": { "name": {"$ref": "urn:name-schema"}, "age": {"$ref": "urn:age-schema"}, "birth-date": {"$ref": "urn:birth-date-schema"}, }, "additionalProperties": False, } > validator = validator_class(schema, registry=registry) E TypeError: create..Validator.__init__() got an unexpected keyword argument 'registry' age_schema = Resource(contents={'type': 'integer', 'format': 'int32', 'minimum': 0, 'maximum': 120}, _specification=) birth_date_schema = Resource(contents={'type': 'string', 'format': 'date'}, _specification=) name_schema = Resource(contents={'$schema': 'https://json-schema.org/draft/2020-12/schema', 'type': 'string'}, _specification=) registry = schema = {'additionalProperties': False, 'properties': {'age': {'$ref': 'urn:age-schema'}, 'birth-date': {'$ref': 'urn:birth-date-schema'}, 'name': {'$ref': 'urn:name-schema'}}, 'required': ['name'], 'type': 'object'} self = validator_class = .Validator'> tests/integration/test_validators.py:144: TypeError - generated xml file: /build/python-openapi-schema-validator/src/openapi-schema-validator-0.6.0/reports/junit.xml - =========================== short test summary info ============================ FAILED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_referencing FAILED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oneof_discriminator[oneOf] FAILED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oneof_discriminator[anyOf] FAILED tests/integration/test_validators.py::TestOAS30ValidatorValidate::test_oneof_discriminator[allOf] FAILED tests/integration/test_validators.py::TestOAS31ValidatorValidate::test_referencing =================== 5 failed, 128 passed, 1 xfailed in 1.67s =================== ==> ERROR: A failure occurred in check().  Aborting... ==> ERROR: Build failed, check /var/lib/archbuild/extra-riscv64/root6/build receiving incremental file list python-openapi-schema-validator-0.6.0-1-riscv64-build.log python-openapi-schema-validator-0.6.0-1-riscv64-check.log python-openapi-schema-validator-0.6.0-1-riscv64-prepare.log sent 81 bytes received 5,030 bytes 3,407.33 bytes/sec total size is 61,063 speedup is 11.95