Skip to content

Using required and allOf together #359

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

Open
flixx opened this issue Jun 10, 2021 · 2 comments
Open

Using required and allOf together #359

flixx opened this issue Jun 10, 2021 · 2 comments

Comments

@flixx
Copy link

flixx commented Jun 10, 2021

Hello,

We are using openapi-core to validate Django Requests.

When I use this syntax:

SaveRequest:
  allOf:
    - $ref: "#/definitions/Dog"
    - required:
      - breed
      - name

I'm getting this error:

...
  File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/openapi_core/validation/request/validators.py", line 204, in _get_body
    body = self._unmarshal(media_type, casted)
  File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/openapi_core/validation/request/validators.py", line 255, in _unmarshal
    return super(RequestValidator, self)._unmarshal(
  File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/openapi_core/validation/validators.py", line 66, in _unmarshal
    return unmarshaller(value)
  File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 49, in __call__
    self.validate(value)
  File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 61, in validate
    errors = tuple(errors_iter)
  File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/jsonschema/validators.py", line 328, in iter_errors
    for error in errors:
  File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/jsonschema/_validators.py", line 315, in allOf
    for error in validator.descend(instance, subschema, schema_path=index):
  File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/jsonschema/validators.py", line 344, in descend
    for error in self.iter_errors(instance, schema):
  File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/jsonschema/validators.py", line 328, in iter_errors
    for error in errors:
  File "/Users/felix/Library/Caches/pypoetry/virtualenvs/button3d-iF01JEUe-py3.8/lib/python3.8/site-packages/openapi_schema_validator/_validators.py", line 43, in required
    prop_schema = schema['properties'][property]

According to this thread, it is a valid schema though:
OAI/OpenAPI-Specification#1608

Also related issue:
#77

@doemski
Copy link

doemski commented Apr 11, 2023

Any news on this issue? Seems to still persist.

Also is there a workaround?

@p1c2u
Copy link
Collaborator

p1c2u commented Apr 11, 2023

@doemski please report separate issue with your details

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

No branches or pull requests

3 participants