asyncapi / spec-json-schemas

AsyncAPI schema versions
Apache License 2.0
51 stars 53 forks source link

Bug in bundler. Schema properties are wrong in at least 2.0.0-rc1-without-$id.json #454

Open smoya opened 9 months ago

smoya commented 9 months ago

Describe the bug

Investigating some schema validation errors given at https://github.com/asyncapi/spec-json-schemas/pull/452, I found out that most of the properties from the schema definition in 2.0.0-rc1-without-$id.json are pointing to #/definitions/json-schema-draft-07-schema. For example:

"minimum": {
  "$ref": "#/definitions/json-schema-draft-07-schema"
},

This is wrong because of two things:

  1. It should not point to the draft-07 schema but rather draft-04, according to the 2.0.0-rc1.json. For example:
    "minimum": {
    "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
    },
  2. It should point to the right properties of the referred schema, not to the schema itself. Meaning #/properties/<the-property> is missing from that pointer.

Since the without-$id files are generated by our bundler , I don't know about the magnitude of this issue. We should definitely check if other schemas are affected as well.

jonaslagoni commented 9 months ago

Problem is here: https://github.com/asyncapi/spec-json-schemas/blob/master/tools/bundler/index.js#L114 and here https://github.com/asyncapi/spec-json-schemas/blob/master/tools/bundler/index.js#L177

smoya commented 9 months ago

Problem is here: https://github.com/asyncapi/spec-json-schemas/blob/master/tools/bundler/index.js#L114 and here https://github.com/asyncapi/spec-json-schemas/blob/master/tools/bundler/index.js#L177

Yup, makes sense. Thanks for spotting it up

derberg commented 9 months ago

for the record, correct draft for any v2 version is draft 7 and not 4

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

smoya commented 4 months ago

It is not yet completed until next major version gets released https://github.com/asyncapi/spec-json-schemas/pull/541

jonaslagoni commented 4 months ago

@smoya why have it open and cluttering issues page when it will eventually be released 🤷‍♂️

smoya commented 4 months ago

@smoya why have it open and cluttering issues page when it will eventually be released 🤷‍♂️

Because the issue is still happening in last release and master branch. Someone could come here and look for issues regarding this bug and see it was closed and, in the best scenario, will lose time understanding that, yeah, it got fixed but not released yet.

github-actions[bot] commented 9 hours ago

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart: