-
Notifications
You must be signed in to change notification settings - Fork 188
fix: do not resolve $ref in examples.value #2392
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
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 |
|
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
d3789e6 to
cfe2086
Compare
a391a25 to
84cdccb
Compare
.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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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. |
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| "@redocly/openapi-core": patch | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also affects the CLI behaviour, so please mention it here as well.
| - 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't affect the Example type, only singular example properties.
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`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
8c79eb4 to
0e4303b
Compare
| id: | ||
| type: integer | ||
| name: | ||
| type: string | ||
| active: | ||
| type: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| id: | |
| type: integer | |
| name: | |
| type: string | |
| active: | |
| type: boolean | |
| $ref: | |
| type: string |
| @@ -0,0 +1,4 @@ | |||
| { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove plz.
0e4303b to
2374fda
Compare
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