Skip to content

fix(rulesets): avoid false errors from ajv#2407

Closed
padamstx wants to merge 1 commit into
stoplightio:developfrom
padamstx:develop
Closed

fix(rulesets): avoid false errors from ajv#2407
padamstx wants to merge 1 commit into
stoplightio:developfrom
padamstx:develop

Conversation

@padamstx

@padamstx padamstx commented Feb 22, 2023

Copy link
Copy Markdown
Contributor

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:
- #2081
- #2140
- ajv-validator/ajv#1426
@padamstx padamstx requested a review from a team as a code owner February 22, 2023 01:20
Comment thread package.json
"prerelease": "patch-package",
"release": "yarn prerelease && yarn workspaces foreach run release"
"release": "yarn prerelease && yarn workspaces foreach run release",
"jest": "jest"

Copy link
Copy Markdown
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
Copy Markdown
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