[BUG] $ref to external files not working?
Closed this issue ยท 6 comments
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
How to Reproduce
This is all done in intellij, version 2024.1.4
- create a .yaml file for a base object
- create another .yaml file referencing that object
- 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?
- I have read the Contributing Guidelines
Are you willing to work on this issue ?
Yes I am willing to submit a PR!
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.
Hi @BenHoopleEmpire - possible duplicate of #48
I'll try your reproduction steps after I take care of #99
I'm going to close this bug as i just upgraded intellij, this should be resolved for myself when 99 is resolved
@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
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 "
@BenHoopleEmpire hi! New version is available