Skip to content

Exception when validating schema with required in oneOf #14

Closed

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'

Activity

  1. changed the title [-]Exception when validate schema with required in oneOf[/-] [+]Exception when validating schema with required in oneOf[/+] on Jun 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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