Skip to content

Exception when validating schema with required in oneOf #14

@DangoXJ

Description

@DangoXJ

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions