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

Dereference behavior does not follow AsyncAPI reference object and JSON Schema draft 7 behavior #404

Closed
jonaslagoni opened this issue Nov 10, 2021 · 8 comments
Labels
bug Something isn't working stale

Comments

@jonaslagoni
Copy link
Member

Describe the bug

We use the @apidevtools/json-schema-ref-parser dependency to resolve all references, however, this has a faulty implementation.

AsyncAPI 2.2.0 defines a reference as:

The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. ... . This object cannot be extended with additional properties and any properties added SHALL be ignored.

JSON Schema draft 7 defines the reference behavior as:

An object schema with a "$ref" property MUST be interpreted as a "$ref" reference. ... . All other properties in a "$ref" object MUST be ignored.

Meaning the two overlap in their behavior (lucky for us).

This means that given the following AsyncAPI document:

asyncapi: '2.2.0'
info:
  title: Test overriding dereferenced objects 
  version: '1.0.0'
channels:
  test:
    publish:
      message:
        $ref: '#/components/messages/myMessage'
        name: 'MyOtherMessageName' # Should not be valid
components:
  messages:
    myMessage:
      name: 'MyMessage'
      payload:
        type: object
        properties:
          sentAt:
            $ref: "#/components/schemas/sentAt"
            description: 'test' # Should not be valid
  schemas:
    sentAt:
      type: string
      format: date-time
      description: Date and time when the message was sent.

Check out the studio example (it uses this parser library for bundling the references)

As it can be seen both name in the AsyncAPI reference object for the message is applied, which results in the message being called MyOtherMessageName and not MyMessage.

Same with the JSON Schema the description of the payload message object it has the description test and not Date and time when the message was sent.

@smoya
Copy link
Member

smoya commented Nov 18, 2021

For the record, there is a recent effort on building JSON Schema foundational tooling with kind of (TBD) official support, lead by @jviotti and @Relequestual here json-schema-org/community#113.

@jonaslagoni
Copy link
Member Author

Potential replacement for the dereferencing library: https:/APIDevTools/json-schema-reader

@magicmatatjahu magicmatatjahu mentioned this issue Mar 3, 2022
20 tasks
@github-actions
Copy link

github-actions bot commented Jun 3, 2022

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

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 ❤️

@github-actions github-actions bot added the stale label Jun 3, 2022
@derberg derberg removed the stale label Jun 7, 2022
@github-actions
Copy link

github-actions bot commented Oct 6, 2022

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

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 ❤️

@github-actions
Copy link

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

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 ❤️

@github-actions github-actions bot added the stale label Feb 15, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2023
@jonaslagoni jonaslagoni reopened this Jun 16, 2023
@github-actions github-actions bot removed the stale label Jun 17, 2023
@github-actions
Copy link

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

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 ❤️

Copy link

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

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 ❤️

@github-actions github-actions bot added the stale label Feb 29, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2024
@jviotti
Copy link

jviotti commented Jun 30, 2024

For the record, the bundle command of the JSON Schema CLI tool I've been working on properly does these kind of stuff: https:/Intelligence-AI/jsonschema/blob/main/docs/bundle.markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

5 participants