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(rulesets): avoid false errors from ajv #2407

Closed
wants to merge 1 commit into from

Conversation

padamstx
Copy link
Contributor

@padamstx padamstx commented Feb 22, 2023

Fixes #2081

Checklist

  • Tests added / updated
  • Docs added / updated

Does this PR introduce a breaking change?

  • Yes
  • No

Additional context

This commit modifies the oasExample function so that example fields are removed from
the schema to be used for validation. This is needed because the presence of an "example" field in a schema confuses ajv in certain scenarios.
References:

This commit modifies the oasExample function so
that example fields are removed from the schema
to be used for validation.  This is needed because
the presence of an "example" field in a schema
confuses ajv in certain scenarios.
References:
- stoplightio#2081
- stoplightio#2140
- ajv-validator/ajv#1426
@padamstx padamstx requested a review from a team as a code owner February 22, 2023 01:20
@@ -39,7 +39,8 @@
"test.karma": "karma start",
"prepare": "husky install",
"prerelease": "patch-package",
"release": "yarn prerelease && yarn workspaces foreach run release"
"release": "yarn prerelease && yarn workspaces foreach run release",
"jest": "jest"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this simply to make it easy to run the jest that is installed in node_modules.
Example: yarn run jest packages/rulesets/src/oas/functions/__tests/oasExample.test.ts.

@padamstx
Copy link
Contributor Author

Closing this PR in favor of this PR.

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.

False error oas3-valid-schema-example reference resolves to more than one schema
1 participant