Skip to content
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

Cast of "wildcard" schemas #418

Closed
zoten opened this issue Jan 25, 2022 · 0 comments · Fixed by #419
Closed

Cast of "wildcard" schemas #418

zoten opened this issue Jan 25, 2022 · 0 comments · Fixed by #419

Comments

@zoten
Copy link
Contributor

zoten commented Jan 25, 2022

Hi everyone! Thanks as always for the work!
Poking around with complex specs, I found the use of "wildcard" shortcuts for expressing "any" schema, like in this modified example

PatchItem:
      properties:
        from:
          type: string
        op:
          $ref: '#/components/schemas/PatchOperation'
        path:
          type: string
        value: {}
      required:
        - op
        - path
      type: object

that value: {} is causing OpenApiSpex Cast to fail, since the inferred type is nil and it is explicitly set as an :invalid_schema_type in current tests.
I have put up two lines to modify this behaviour, if it is ok to accept the {} schema as "whatever"
Let me know if it is acceptable, thanks!

zoten pushed a commit to zoten/open_api_spex that referenced this issue Jan 25, 2022
mbuhot added a commit that referenced this issue Jan 27, 2022
* [change] allow empty schemas to be validated as wildcards

Fix #418

* Update lib/open_api_spex/cast.ex

Co-authored-by: Mike Buhot <m.buhot@gmail.com>

Co-authored-by: Luca Dei Zotti <luca.deizotti@athonet.com>
Co-authored-by: Mike Buhot <m.buhot@gmail.com>
lucacorti pushed a commit to lucacorti/open_api_spex that referenced this issue Feb 13, 2022
…pex#419)

* [change] allow empty schemas to be validated as wildcards

Fix open-api-spex#418

* Update lib/open_api_spex/cast.ex

Co-authored-by: Mike Buhot <m.buhot@gmail.com>

Co-authored-by: Luca Dei Zotti <luca.deizotti@athonet.com>
Co-authored-by: Mike Buhot <m.buhot@gmail.com>
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