chore: add linting for dataValue in example#2945
Open
Daryna-del wants to merge 4 commits into
Open
Conversation
🦋 Changeset detectedLatest commit: 4398fb7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
Performance Benchmark (Lower is Faster)
|
Contributor
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1783680915 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1783680915 |
JLekawa
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What/Why/How?
OpenAPI 3.2 introduced
dataValueas the schema-checked example field, but the linter never validated it, so invaliddataValueexamples passed silently. This adds linting fordataValueagainst its schema, matching howvalueis linted.Reference
Comment in the issue #919
Testing
Tests passed successfully on monorepo.
Screenshots (optional)
Check yourself
Security
Note
Low Risk
Targeted extension of existing example validation with backward-compatible
valuehandling; no auth, runtime API, or data-path changes.Overview
OpenAPI 3.2 Example objects can put schema-checked payloads in
dataValue, butno-invalid-parameter-examplesandno-invalid-media-type-examplesonly validatedvalue, so baddataValueexamples could pass lint.This PR adds
getExampleValueToValidatein rule utils: preferdataValuewhen set, otherwisevalue, and skip when neither is present. Both rules run the same AJVvalidateExampleflow on the chosen field.no-invalid-media-type-examplesalso adjusts example$refresolution and error locations so diagnostics point atdataValue(orvalue) under the resolved example.Docs for both rules document
dataValuebehavior; tests cover invalid/valid cases, **$ref**d examples, binarydataValue,serializedValueignored for schema checks, and legacyvalueon 3.2.@redocly/openapi-coregets a minor changeset entry.Reviewed by Cursor Bugbot for commit 4398fb7. Bugbot is set up for automated code reviews on this repo. Configure here.