fix: do not resolve $ref in examples.value#2392
Merged
Conversation
🦋 Changeset detectedLatest commit: 2374fda 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
|
JLekawa
reviewed
Oct 28, 2025
JLekawa
approved these changes
Oct 28, 2025
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
d3789e6 to
cfe2086
Compare
tatomyr
reviewed
Oct 31, 2025
tatomyr
reviewed
Oct 31, 2025
tatomyr
reviewed
Oct 31, 2025
a391a25 to
84cdccb
Compare
tatomyr
reviewed
Nov 6, 2025
.changeset/loud-mails-hang.md
Outdated
| "@redocly/openapi-core": patch | ||
| --- | ||
|
|
||
| Fixed an issue where the content of `$ref`s inside `Examples.value` was erroneously resolved during bundling and linting. |
Collaborator
There was a problem hiding this comment.
Suggested change
| Fixed an issue where the content of `$ref`s inside `Examples.value` was erroneously resolved during bundling and linting. | |
| Fixed an issue where the content of `$ref`s inside example values was erroneously resolved during bundling and linting. |
tatomyr
reviewed
Nov 6, 2025
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| "@redocly/openapi-core": patch | |||
Collaborator
There was a problem hiding this comment.
It also affects the CLI behaviour, so please mention it here as well.
tatomyr
reviewed
Nov 6, 2025
| - doNotResolveExamples | ||
| - boolean | ||
| - When running `lint`, set this option to `true` to avoid resolving `$ref` fields in examples. Resolving `$ref`s in other parts of the API is unaffected. | ||
| - Set this option to `true` to prevent resolving `$ref` fields in `Example`. This affects both `lint` and `bundle` commands. Resolving `$ref`s in other parts of the API description is unaffected. |
Collaborator
There was a problem hiding this comment.
It doesn't affect the Example type, only singular example properties.
tatomyr
reviewed
Nov 6, 2025
docs/@v2/configuration/resolve.yaml
Outdated
| type: boolean | ||
| description: >- | ||
| You can stop `lint` from resolving `$refs` in examples by setting this configuration option to `true`. | ||
| Set this option to `true` to prevent resolving `$ref` fields in `Example`. |
8c79eb4 to
0e4303b
Compare
tatomyr
reviewed
Nov 7, 2025
Comment on lines
+15
to
+20
| id: | ||
| type: integer | ||
| name: | ||
| type: string | ||
| active: | ||
| type: boolean |
Collaborator
There was a problem hiding this comment.
Suggested change
| id: | |
| type: integer | |
| name: | |
| type: string | |
| active: | |
| type: boolean | |
| $ref: | |
| type: string |
tatomyr
reviewed
Nov 7, 2025
| @@ -0,0 +1,4 @@ | |||
| { | |||
tatomyr
approved these changes
Nov 7, 2025
0e4303b to
2374fda
Compare
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?
What: Stop resolving $ref inside Examples.value and dataValue (oas3.2) during bundling. Only resolve when the Example itself is a Reference Object, not when a $ref appears inside the literal value.
Why: Per OpenAPI spec and Redocly refs guide, Examples.value must be treated literally; resolving $ref there is incorrect.
Reference
Fixes #1371
Testing
Added new unit and e2e tests
Screenshots (optional)
Check yourself
Security