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

Error in yaml file are no longer reported #200

Open
SzymonMalczak opened this issue Dec 14, 2023 · 9 comments
Open

Error in yaml file are no longer reported #200

SzymonMalczak opened this issue Dec 14, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@SzymonMalczak
Copy link

Describe the bug

Since version 0.6 the errors in the file are no longer reported.
Before parsing errors were shown in the preview window, now the preview is empty.

How to Reproduce

Following file

asyncapi: 2.6.0
info:
title: Message
version: "0.1.0"

Output in previous version:
image

Output in new version:
image

Expected behavior

Errors should be reported.

@SzymonMalczak SzymonMalczak added the bug Something isn't working label Dec 14, 2023
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
Copy link
Collaborator

ivangsa commented Dec 19, 2023

Hi @SzymonMalczak
thanks for taking the time to report this error,
it was reported upstream already..

@ababkin
Copy link

ababkin commented Aug 31, 2024

any update on this? is there an upstream link? (i cannot find)
this feature feels pretty important
thanks!

@catosaurusrex2003
Copy link
Contributor

@ivangsa
The current "@asyncapi/react-component": "^2.2.5" has got support for showing errors in the document.
Issues:
asyncapi/asyncapi-react#1048
asyncapi/asyncapi-react#874
The pr which introduces the changes:
asyncapi/asyncapi-react#1068

But by simply upgrading the @asyncapi/react-component dependency in the extension doesnt cause any change in the working of the extension. It still shows a blank page on error. ( i tried this while testing locally )

Am i missing something here which is causes this ?
cuz i think upgrading the dependency should fix the issue of blank screen.

@ivangsa
Copy link
Collaborator

ivangsa commented Oct 8, 2024

@catosaurusrex2003 can you have a look at this code:

https://github.com/asyncapi/vs-asyncapi-preview/blob/master/src/PreviewWebPanel.ts#L142

maybe now we need to instantiate this with different parameters

@catosaurusrex2003
Copy link
Contributor

@ivangsa i found what the issue is.

only the schema.options needs to be changed to schema.requestOptions

But even doing this wont make errors render.

the problem is present in https://github.com/asyncapi/asyncapi-react/blob/master/library/src/containers/AsyncApi/Standalone.tsx

The problem is that AsyncApiComponent inside Standalone.tsx relies on the error props being passed down onto it from AsyncApiComponent inside AsyncApi.tsx.
( Hence why errors are rendered in the playground and not in the extension. cuz we are directly using standalone without any parent )

This might have been my short-sightedness while doing the PR.

So the solution for this is to make it so that SpecificationHelpers.retrieveParsedSpec supports returning errors so that <Error /> can be conditionally rendered even without the need for the props ( This will make it work in our extension )

Pls correct me if i am wrong or if i am missing ourt on the bigger picture.

@ivangsa
Copy link
Collaborator

ivangsa commented Oct 8, 2024

@catosaurusrex2003 you know more than me about this

propose what do you think is the best solution,

can we pass any kind of object to AsyncApiStandalone.render that will held the errors in case there are any?

@catosaurusrex2003
Copy link
Contributor

can we pass any kind of object to AsyncApiStandalone.render that will held the errors in case there are any?

I dont think this will be possible because this will require us to parse the document so that we can pass errors to AsyncApiStandalone.render. This defeats the purpose of having a AsyncApiStandalone in itself.

So the solution for this is to make it so that SpecificationHelpers.retrieveParsedSpec supports returning errors so that can be conditionally rendered even without the need for the props ( This will make it work in our extension )

I think this is the only way to go as of now.

Let me work on modifying AsyncApiStandalone and test the playground and this extension both locally and raise a PR for this.
I will get back to you @ivangsa.

@AceTheCreator you are more well versed with @asyncapi/react-component. Please let me know if i am on the right track.

@catosaurusrex2003
Copy link
Contributor

catosaurusrex2003 commented Oct 9, 2024

@ivangsa

image

needed to do changes in @asyncapi/react-component and now working.
Will create a PR in that repo and hopefully it will get merged and start working here after we bump the version.

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

No branches or pull requests

4 participants