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

JSON Schema preview is broken #194

Closed
kbolino opened this issue Sep 27, 2023 · 5 comments · Fixed by #201
Closed

JSON Schema preview is broken #194

kbolino opened this issue Sep 27, 2023 · 5 comments · Fixed by #201
Assignees
Labels
bug Something isn't working released

Comments

@kbolino
Copy link

kbolino commented Sep 27, 2023

Describe the bug

If I try to preview a JSON schema file which has no connection to AsyncAPI, I get a white page with black text that says only:

Error: The asyncapi field is missing.

How to Reproduce

Create a file test.schema.json with the following content:

{"$schema": "https://json-schema.org/draft-07/schema"}

Then click the "Preview AsyncAPI" button or Cmd+Shift+P (macOS) and select the option.

Screenshot 2023-09-27 at 18 22 38

This appears to be identical to this issue from a similar plugin for IDEA.

Expected behavior

Either the preview option should be unavailable (because it doesn't work on this file type) or, even better, I should see a nice overview of the schema (assuming it was not trivial, like the example I gave).

@kbolino kbolino added the bug Something isn't working label Sep 27, 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.

@ivangsa ivangsa self-assigned this Sep 28, 2023
@ivangsa
Copy link
Collaborator

ivangsa commented Sep 28, 2023

@kbolino thanks for reporting this issue.
We will fix this disabling AsyncAPI preview for non asyncapi files.

@Savio629
Copy link
Contributor

Savio629 commented Dec 13, 2023

So while debugging I found out that the isAsyncapi value could have caused the issue->

For asyncapi.yaml files

yamlisasyncapi

For asyncapi.json files

jsonisasyncapi

For non asyncapi (json) files

wrongjsonisasyncapi

So by just adding the following condition AsyncAPI preview will be disable for non asyncapi files ->

isasyncapi1

Also for best practices would prefer using parenthesis here ->

packagejsonerror

@Savio629
Copy link
Contributor

Should I open a pull request?

ivangsa added a commit to ivangsa/vs-asyncapi-preview that referenced this issue Dec 17, 2023
@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 0.6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

4 participants