Skip to content

Validating nested items in array elements types #155

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
dawidgdanski opened this issue Aug 29, 2019 · 1 comment · Fixed by #157
Closed

Validating nested items in array elements types #155

dawidgdanski opened this issue Aug 29, 2019 · 1 comment · Fixed by #157
Labels
area/schema Indicates an issue on schema area

Comments

@dawidgdanski
Copy link

dawidgdanski commented Aug 29, 2019

Hey,

I encountered one problem I haven't found solution for when using the openapi-core:

I developed the schema with an array property:

...
errors:
   type: array
          items:
            $ref: '#/components/schemas/ErrorReference'
...

I wrote the tests to verify that the errors array does contain the ErrorReference objects by comparing examplary dictionary against the schema I defined using registered schemas accessible in Spec.components.schemas.

When adding nested items entry under the existing items:

...
errors:
   type: array
          items:
               items:
                  $ref: '#/components/schemas/ErrorReference'
...

then what I expected was that the upper-level items would be inferred with the array type, the lower-level items with ErrorReference type (so that we would have the array of arrays of ErrorReferences) and the validation would fail due to the incorrect type found in while validating examplary object dictionary against the schema.

The tests still pass and regardless of how many nested items entries are added.

Is it a bug/missing functionality in the validation or am I not using the library correctly to validate nested arrays types?

Many thanks for the response.

@p1c2u
Copy link
Collaborator

p1c2u commented Sep 5, 2019

@dawidgdanski thank you for the report.
It's missing functionality which will be added with new validator.

@p1c2u p1c2u added the area/schema Indicates an issue on schema area label Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/schema Indicates an issue on schema area
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants