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

Circular references in referenced OpenAPI broken: Error: Token "ChildObject" does not exist. #734

Closed
daniel-sc opened this issue Jul 21, 2022 · 9 comments
Labels
bug Something isn't working stale

Comments

@daniel-sc
Copy link

Describe the bug

I get the following error on running ag asyncapi.yaml @asyncapi/html-template:

Something went wrong:
Error: Token "ChildObject" does not exist.
    at dereference (c:\devsbb\eaio-ng\nodejs\16\node_modules\@asyncapi\generator\node_modules\@asyncapi\parser\lib\parser.js:160:11)
    at handleCircularRefs (c:\devsbb\eaio-ng\nodejs\16\node_modules\@asyncapi\generator\node_modules\@asyncapi\parser\lib\parser.js:174:3)
    at parse (c:\devsbb\eaio-ng\nodejs\16\node_modules\@asyncapi\generator\node_modules\@asyncapi\parser\lib\parser.js:109:35)
    at Generator.generateFromString (c:\devsbb\eaio-ng\nodejs\16\node_modules\@asyncapi\generator\lib\generator.js:265:22)
    at c:\devsbb\eaio-ng\nodejs\16\node_modules\@asyncapi\generator\cli.js:154:9

Observation 1: When the circular refrence in ChildObject is removed, the generation works fine!
Observation 2: When both schemas (ChildObject, ParentObject) are defined inside asyncapi.yaml everything works fine as well!

How to Reproduce

asyncapi.yaml:

asyncapi: 2.0.0
info:
  title: Account Service
  version: 1.0.0
  description: "This service is in charge of processing user signups :rocket:"
channels:
  user/parent:
    subscribe:
      message:
        payload:
          $ref: 'openapi.yaml#/components/schemas/ParentObject'
  user/child:
    subscribe:
      message:
        payload:
          $ref: 'openapi.yaml#/components/schemas/ChildObject'
components:
  schemas: {}

openapi.yaml:

openapi: 3.0.3
info:
  title: Title
  description: Title
  version: 1.0.0
servers:
  - url: 'https'
paths: { }
components:
  schemas:
    ParentObject:
      type: object
      properties:
        child:
          $ref: '#/components/schemas/ChildObject'
    ChildObject:
      type: object
      properties:
        sister:
          $ref: '#/components/schemas/ChildObject'

Expected behavior

Expect to generate successfully.

@daniel-sc daniel-sc added the bug Something isn't working label Jul 21, 2022
@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 Nov 19, 2022
@daniel-sc
Copy link
Author

This is still an open bug.

@github-actions github-actions bot removed the stale label Nov 20, 2022
@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 Mar 21, 2023
@daniel-sc
Copy link
Author

This is still open and relevant

@jonaslagoni
Copy link
Member

I actually think this is a bug in a library the parser is using, this sounds related to the following: APIDevTools/json-schema-ref-parser#308

@jonaslagoni jonaslagoni transferred this issue from asyncapi/generator Mar 21, 2023
@github-actions
Copy link

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.

@github-actions github-actions bot removed the stale label Mar 22, 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 ❤️

@github-actions github-actions bot added the stale label Jul 20, 2023
@daniel-sc
Copy link
Author

Not stale

@github-actions github-actions bot removed the stale label Jul 25, 2023
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 Nov 23, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 24, 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 stale
Projects
None yet
Development

No branches or pull requests

2 participants