Skip to content

Conversation

@karol-maciaszek
Copy link

@karol-maciaszek karol-maciaszek commented Jun 16, 2020

Fixes condition which controls rejection of empty parsing result.

continueOnError has to be false and allowEmpty has to be false in order for the empty result to cause rejection

This fixes https://github.com/stoplightio/platform-internal/issues/2822

@karol-maciaszek karol-maciaszek requested a review from P0lip June 16, 2020 22:52
lib/parse.js Outdated

function onParsed (parser) {
if ((options.continueOnError || !parser.plugin.allowEmpty) && isEmpty(parser.result)) {
if (!options.continueOnError && !parser.plugin.allowEmpty && isEmpty(parser.result)) {
Copy link

Choose a reason for hiding this comment

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

This is close, but not quite correct.
We should still throw when continueOnError true, so the condition could look as follows

Suggested change
if (!options.continueOnError && !parser.plugin.allowEmpty && isEmpty(parser.result)) {
if (!parser.plugin.allowEmpty && isEmpty(parser.result)) {

You may need to pass allowEmpty in exporter service

Copy link
Author

@karol-maciaszek karol-maciaszek Jun 17, 2020

Choose a reason for hiding this comment

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

allowEmpty defaults to true && I fixed this continueOnError.

@karol-maciaszek karol-maciaszek requested a review from P0lip June 17, 2020 14:04
@karol-maciaszek karol-maciaszek merged commit d75be5e into stoplightio:master Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants