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

Feature Request: Ability to exit on validation warnings #1603

Closed
ezequiel opened this issue Aug 30, 2024 · 4 comments
Closed

Feature Request: Ability to exit on validation warnings #1603

ezequiel opened this issue Aug 30, 2024 · 4 comments
Assignees
Labels
workaround A workaround has been provided

Comments

@ezequiel
Copy link
Contributor

Description

Right now we only exit when there are validation errors. We also want the ability to exit on warnings, since we don't want to introduce warnings into the codebase.

Warnings also generally point out good things we should fix anyway, e.g.

=> S2OError: (Patchable) path parameters must be required:true [limit in get:/api/v1/my_endpoint]
@ezequiel ezequiel changed the title Feature Request: Ability to exit on validation warnings limit Feature Request: Ability to exit on validation warnings Aug 30, 2024
ezequiel added a commit to ezequiel/orval that referenced this issue Aug 30, 2024
ezequiel added a commit to ezequiel/orval that referenced this issue Aug 30, 2024
@ezequiel
Copy link
Contributor Author

ezequiel commented Aug 30, 2024

Hmm, for some reason process.exit(1)s are stripped in the @orval/core bundle (at least the one published to NPM, not a local build):

// node_modules/@orval/core/dist/index.js line 47758
var ibmOpenapiRuleset = require("@ibm-cloud/openapi-ruleset");
var { Spectral } = require_dist10();
var ibmOpenapiValidator = async (specs) => {
  const spectral = new Spectral();
  spectral.setRuleset(ibmOpenapiRuleset);
  const { errors, warnings } = await spectral.run(specs);
  if (warnings && warnings.length) {
    ibmOpenapiValidatorWarnings(warnings);
  }
  if (errors && errors.length) {
    ibmOpenapiValidatorErrors(errors);
  }
};

even though it's clearly in the code:

if (errors.length) {
ibmOpenapiValidatorErrors(errors);
process.exit(1);
}

There also doesn't appear to be any build steps that remove process calls. Anyone know what's up here?

@melloware melloware added the enhancement New feature or request label Aug 30, 2024
@melloware
Copy link
Collaborator

I think it was reported here too about the Exit Code: #1497

Something funky is going on.

@yoshi2no
Copy link
Contributor

yoshi2no commented Sep 3, 2024

Hmm, for some reason process.exit(1)s are stripped in the @orval/core bundle (at least the one published to NPM, not a local build):

@ezequiel

I think it’s likely because the commit that added process.exit(1) was part of the latest 7.1.0 release. From the code you shared, it seems like you might be using a bundle of @orval/core from before that 7.1.0 release 👀

@melloware
Copy link
Collaborator

ok @ezequiel can you try 7.1.0 now that is is out?

@melloware melloware added workaround A workaround has been provided and removed enhancement New feature or request labels Sep 3, 2024
@melloware melloware closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workaround A workaround has been provided
Projects
None yet
Development

No branches or pull requests

3 participants