python-openapi/openapi-schema-validator

Exception when validating schema with required in oneOf

DangoXJ opened this issue · 0 comments

Code:

from openapi_schema_validator import validate
instance = {
    'n3IwfId': 'string',
}
schema = {
    "type": "object",
    "properties": {
        "n3IwfId": {"type": "string"},
        "wagfId": {"type": "string"},
    },
    "oneOf": [
        {"required": ["n3IwfId"]},
        {"required": ["wagfId"]},
    ],
}
validate(instance, schema)

Exception:
File "/usr/local/lib/python3.9/site-packages/jsonschema/validators.py", line 328, in iter_errors
for error in errors:
File "/usr/local/lib/python3.9/site-packages/openapi_schema_validator/_validators.py", line 43, in required
prop_schema = schema['properties'][property]
KeyError: 'properties'