Skip to content

Exception when validating schema with required in oneOf #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DangoXJ opened this issue Jun 13, 2021 · 0 comments · Fixed by #16
Closed

Exception when validating schema with required in oneOf #14

DangoXJ opened this issue Jun 13, 2021 · 0 comments · Fixed by #16

Comments

@DangoXJ
Copy link

DangoXJ commented Jun 13, 2021

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'

@DangoXJ DangoXJ changed the title Exception when validate schema with required in oneOf Exception when validating schema with required in oneOf Jun 13, 2021
@p1c2u p1c2u closed this as completed in #16 Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant