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

[BUG] $ref to external files not working? #101

Closed
2 tasks done
BenHoopleEmpire opened this issue Aug 23, 2024 · 6 comments · Fixed by #104
Closed
2 tasks done

[BUG] $ref to external files not working? #101

BenHoopleEmpire opened this issue Aug 23, 2024 · 6 comments · Fixed by #104
Assignees
Labels
bug Something isn't working

Comments

@BenHoopleEmpire
Copy link

Describe the bug.

this bug deals with the $ref variable not working as expected.

Context:
working with the $ref value is pretty critical for reducing repetition within our docs. I'll give the following basic example:

file: User.yaml

User:
  description: ...
  type: object
  properties:
    name:
      type: string

next file Admin.yaml:

Admin:
  desc: ...
  type: object
  properties:
    user:
      $ref: './User.yaml#User'
    privilege:
      type: string

Now if i reference Admin.yaml in a components section of an asyncapi.yaml file it fails
i.e. $ref: '../CommonObjects/Admin.yaml#/Admin'

I know the paths are correct because i've swapped them around and it loads, it is having a hard time with the references inside a file it references.

If this is expected behaviour I'd like to know that, but i feel like this should be possible. I've also looked for any settings but cant find anything that seems to line up with that.

Expected behavior

Expected to see the object being referenced while containing references itself.

Screenshots

image

How to Reproduce

This is all done in intellij, version 2024.1.4

  1. create a .yaml file for a base object
  2. create another .yaml file referencing that object
  3. create a 3rd .yaml file which references the file from step 2.

🥦 Browser

Google Chrome

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

@BenHoopleEmpire BenHoopleEmpire added the bug Something isn't working label Aug 23, 2024
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.

@philCryoport
Copy link
Collaborator

philCryoport commented Aug 23, 2024

Hi @BenHoopleEmpire - possible duplicate of #48

I'll try your reproduction steps after I take care of #99

@philCryoport philCryoport changed the title [BUG] <description> [BUG] $ref to external files not working? Aug 23, 2024
@BenHoopleEmpire
Copy link
Author

I'm going to close this bug as i just upgraded intellij, this should be resolved for myself when 99 is resolved

@Pakisan
Copy link
Member

Pakisan commented Aug 28, 2024

@BenHoopleEmpire you can clone repo and run

./gradlew :builPlugin

to build new version and test your cases. I have checked, looks like everything is working fine

After that install if from build/distributions

Screenshot 2024-08-28 at 22 58 01

@Pakisan
Copy link
Member

Pakisan commented Aug 28, 2024

Now if i reference Admin.yaml in a components section of an asyncapi.yaml file it fails
i.e. $ref: '../CommonObjects/Admin.yaml#/Admin'

I know the paths are correct because i've swapped them around and it loads, it is having a hard time with the references inside a file it references.

If this is expected behaviour I'd like to know that, but i feel like this should be possible. I've also looked for any settings but cant find anything that seems to line up with that.

Yep, it works like expected. You enfaced with this problem because of using of single quotes

Now, I also handling ', so behavior is identical to "

Screenshot 2024-08-28 at 23 09 02

@Pakisan
Copy link
Member

Pakisan commented Sep 3, 2024

@BenHoopleEmpire hi! New version is available

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

Successfully merging a pull request may close this issue.

3 participants