-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Message details (payload) not rendered correctly when $ref is used in channels #204
Comments
Hi @AMulgrave thanks for taking the time to report this You are right, this asyncapi.yml file renders alright in https://studio.asyncapi.com/ I will need to investigate further. |
Hi @AMulgrave we have investigates this issue, and we a reporting it to the react-component upstream... Any way, you can simplify your asyncapi.yml definition without loosing any readability or reusability, for instance placing the |
HI @ivangsa , In the case you haven't I would like to work towards it. |
@ashmit-coder please, go ahead an create a PR! |
|
This is just an example to show the issue from a single file. In my project the channel definitions are in an external file. |
Could you please provide aother image this one is not visible |
In practice, I have the yaml structured that way to provide links to external yaml definitions. For simplicity, I provided the example to show the issue in one yaml file. |
@ashmit-coder @ivangsa Have a look on this #240, if it is fine we can close this on both the repos. |
hi @aditygrg2, I'm not convinced of #240 why it fixes the issue? what was causing the problem? |
hello @ivangsa prefetching the complete text and using it as schema does not cause this problem, when fetched the order mattered, parsing happens synchronously top to bottom, if there are any references to a reference which are defined later, as in this case, it didn't worked |
so, how it works in the Studio... it's not using the same parser or react/component? |
@ivangsa not much experience about the studio, but as I can see here it also passes in the complete content, instead of fetching |
This is where the parsing of the schema is done in the react/component I guess something is quite not right on the parsing for this not to work.. I think would be a better fix to understand the root cause before adventuring a fix.. |
I dont like the idea of fixing something without understanding why... I cant find where the standalone component parses the url, but if I do this on a separate project it seems that it resolves the channels :-/ import { Parser, fromURL, stringify, unstringify } from "@asyncapi/parser";
const parser = new Parser();
const { document, diagnostics } = await fromURL(
parser,
"https://github.com/asyncapi/vs-asyncapi-preview/files/13897525/asyncapi.yaml.txt",
).parse();
// console.log(document, diagnostics);
console.log(stringify(document)); |
@aditygrg2 are you willing to maintain (or even improve) this vscode extension? |
@ivangsa Yes, agree. I might be wrong, but I think the VSCode works differently in some way from the web browsers, the same code is being used on the react/component and VSCode but on web browser it works. Here are some of my findings: Ref is not getting parsed, so if you log the parsed schema with the same order, here is what appears: But if you use the complete operations tag below (at the bottom of the file), it will parse successfully because the operations references will not require the previous references to be fulfilled as they will be there already by parser. It depends on the reference orders. Here the operations depends on channels, channels on component which is not rendered until that part of the code is parsed, if you put the complete operations block at the end it will work. There might be more caveats to this, but my findings for anyone else to look out for the exact issue! |
Yes, I would love to help! |
asyncapi.yaml.txt
Loading the yaml attachment into VS Code renders as follows:
Note the missing payload details for the channels messages using $ref.
While the same yaml renders correctly in Web Studio beta:
The rendering is also incomplete when the channels messsages are $ref to external asyncapi yaml files.
The text was updated successfully, but these errors were encountered: