fix: more sane errors for unclosed flow collections #52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.