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

Invalid array definitions in JSON schemas #490

Closed
mxr576 opened this issue Feb 7, 2024 · 3 comments
Closed

Invalid array definitions in JSON schemas #490

mxr576 opened this issue Feb 7, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@mxr576
Copy link

mxr576 commented Feb 7, 2024

Describe the bug

I am building a validator in PHP based on https://github.com/justinrainbow/json-schema and that package and PHP in general turned out to be more strict regarding schema validation than Javascript. Therefore I have a strong gut feeling that the issue that the above-mentioned library reports when it tries to validate https://github.com/asyncapi/spec/blob/v2.6.0/examples/streetlights-kafka.yml on https://github.com/asyncapi/spec-json-schemas/blob/v6.4.0/schemas/2.6.0-without-%24id.json are in the schema definitions and not bugs in the validator.

By making the following dummy changes to JSON schema, these reported issue goes away.

image

Every occurrence of "items": true in an array type should be audited and fixed properly.

How to Reproduce

Steps to reproduce the issue. Attach all resources that can help us understand the issue:

  • Screenshots
  • Link to GitHub repository with project that has issues
  • Files that can help reproduce the issue, like your AsyncAPI file, either paste inside the issue in a code block or in a sharable gist

Expected behavior

A clear and concise description of what you expected to happen.

@mxr576 mxr576 added the bug Something isn't working label Feb 7, 2024
Copy link

github-actions bot commented Feb 7, 2024

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@jonaslagoni
Copy link
Member

jonaslagoni commented Feb 7, 2024

@mxr576 the library you linked does not support JSON Schema draft 7 which the documents are written in, you need to down grade the schema before using the validator.

@mxr576
Copy link
Author

mxr576 commented Feb 7, 2024

@jonaslagoni you are absolutely right, after your message I have also found jsonrainbow/json-schema#576... sorry for the noise here.

(To my excuse, I have also checked several JSON Schema examples, docs to see if this should be valid or not...)

@mxr576 mxr576 closed this as completed Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants