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

fix: more sane errors for unclosed flow collections #52

Merged
merged 1 commit into from
Apr 21, 2021

Conversation

P0lip
Copy link
Contributor

@P0lip P0lip commented Apr 21, 2021

For https://github.com/stoplightio/platform-internal/issues/6014
We could potentially address this in yaml-ast-parser, but IMHO what the parser does is correct. The parser is not to be blamed for trying to accumulate all errors.

The alternative approach I considered was adding some condition here https://github.com/stoplightio/yaml-ast-parser/blob/master/src/loader.ts#L854.
I was thinking of something as follows: if, say, comma is missed 5 times, we would just naively assume the flow collection might be possibly never closed correctly and just stop collecting these errors until the loading is able to recover.
However as said above, the parser does something incorrectly, so we can just filter them out here.

@P0lip P0lip changed the title fix: sane errors for unclosed flow collections fix: more sane errors for unclosed flow collections Apr 21, 2021
@P0lip P0lip self-assigned this Apr 21, 2021
@P0lip P0lip added the bug Something isn't working label Apr 21, 2021
@P0lip P0lip requested review from a team, paulatulis and billiegoose and removed request for a team April 21, 2021 10:31
Copy link

@paulatulis paulatulis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@P0lip I looked over this and at the ticket. I believe that it does what it says it does if it's passing these new tests, but I have a question about why we account for this in this repo and not in Spectral. If time permits, would you be able to tell me how this fits into the larger picture?

@wmhilton will let you approve since you have more knowledge here.

@P0lip
Copy link
Contributor Author

P0lip commented Apr 21, 2021

I have a question about why we account for this in this repo and not in Spectral.

Spectral consumes the errors produced by this package and its equivalent for JSON (@stoplight/json).

If time permits, would you be able to tell me how this fits into the larger picture?

Sure, perhaps we can sync at some point? Might be easier to go over it on a call.

Copy link
Contributor

@billiegoose billiegoose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@P0lip P0lip merged commit 6d15f99 into master Apr 21, 2021
@P0lip P0lip deleted the fix/sane-unexpected-flow-errors branch April 21, 2021 21:25
@stoplight-bot
Copy link
Collaborator

🎉 This PR is included in version 4.2.2 🎉

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 this pull request may close these issues.

4 participants