-
Notifications
You must be signed in to change notification settings - Fork 191
fix: error can't resolve $ref when components.parameters has a ref to the components.schemas
#2407
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
Open
AlbinaBlazhko17
wants to merge
25
commits into
main
Choose a base branch
from
fix/cant-resolve-error-in-remove-unused-components
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+83
−5
Open
Changes from 8 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
082d968
fix: can't resolve ref error when using
AlbinaBlazhko17 fc7f396
feat: add test for the specific case
AlbinaBlazhko17 982edb9
feat: add changeset
AlbinaBlazhko17 b6843a8
chore: add comment
AlbinaBlazhko17 1a8fea3
chore: remove comment
AlbinaBlazhko17 673289f
Update .changeset/happy-chairs-drop.md
AlbinaBlazhko17 d03375a
Update .changeset/happy-chairs-drop.md
JLekawa 06df369
chore: add docs for the bundle command
AlbinaBlazhko17 842eba1
docs: change naming
AlbinaBlazhko17 d7d1092
fix: add to param name and change snapshot
AlbinaBlazhko17 e4acbe3
chore: change order
AlbinaBlazhko17 3a43128
feat: implement new fix to cover parameters + other components
AlbinaBlazhko17 1219167
Revert "feat: implement new fix to cover parameters + other components"
AlbinaBlazhko17 5159619
feat: implement new fix to cover parameters + other components
AlbinaBlazhko17 9744269
feat: implement new fix to cover parameters + other components
AlbinaBlazhko17 bc4d481
Update .changeset/happy-chairs-drop.md
AlbinaBlazhko17 40dfc66
feat: implement proper logic for decorator and bundle-visitor
AlbinaBlazhko17 1c4dc8a
refactor: resolveBundledComponent location
AlbinaBlazhko17 803c12c
fix: change in all places to make ref id from the root document
AlbinaBlazhko17 878586c
chore: remove changes in decorator due to proper resolve
AlbinaBlazhko17 bb9e3e7
fix: ajv instance resolve ref and unit test snapshots
AlbinaBlazhko17 2379a4e
chore: revert previous fix
AlbinaBlazhko17 5d4f009
chore: revert tests
AlbinaBlazhko17 fac1645
feat: add wrapper for resolve function with a default value
AlbinaBlazhko17 7b0d730
refactor: override of the default arguments in resolve function
AlbinaBlazhko17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@redocly/openapi-core": patch | ||
| --- | ||
|
|
||
| Fixed an issue where the `remove-unused-compoents` decorator threw a `Can't resolve $ref` error. This issue occurred when `components.parameters` had a `$ref` to `components.schemas`. | ||
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
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
17 changes: 17 additions & 0 deletions
17
tests/e2e/bundle/parameters-reference-to-schemas/openapi.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| openapi: 3.0.0 | ||
| info: | ||
| title: Sample API | ||
| version: 1.0.0 | ||
| paths: | ||
| /users: | ||
| get: | ||
| operationId: getUsers | ||
| summary: Get a list of users | ||
| parameters: | ||
| - $ref: parameters.yaml#/Param | ||
| responses: | ||
| '200': | ||
| description: A list of users | ||
| content: | ||
| application/json: | ||
| schema: {} |
5 changes: 5 additions & 0 deletions
5
tests/e2e/bundle/parameters-reference-to-schemas/parameters.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Param: | ||
| in: query | ||
AlbinaBlazhko17 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| required: true | ||
| schema: | ||
| $ref: schemas.yaml#/Schema | ||
6 changes: 6 additions & 0 deletions
6
tests/e2e/bundle/parameters-reference-to-schemas/redocly.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apis: | ||
| test-api: | ||
| root: openapi.yaml | ||
|
|
||
| decorators: | ||
| remove-unused-components: on |
2 changes: 2 additions & 0 deletions
2
tests/e2e/bundle/parameters-reference-to-schemas/schemas.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Schema: | ||
| type: string |
30 changes: 30 additions & 0 deletions
30
tests/e2e/bundle/parameters-reference-to-schemas/snapshot.txt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| openapi: 3.0.0 | ||
| info: | ||
| title: Sample API | ||
| version: 1.0.0 | ||
| paths: | ||
| /users: | ||
| get: | ||
| operationId: getUsers | ||
| summary: Get a list of users | ||
| parameters: | ||
| - $ref: '#/components/parameters/Param' | ||
| responses: | ||
| '200': | ||
| description: A list of users | ||
| content: | ||
| application/json: | ||
| schema: {} | ||
| components: | ||
| schemas: | ||
| Schema: | ||
| type: string | ||
| parameters: | ||
| Param: | ||
| in: query | ||
AlbinaBlazhko17 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| required: true | ||
| schema: | ||
| $ref: '#/components/schemas/Schema' | ||
|
|
||
| bundling openapi.yaml using configuration for api 'test-api'... | ||
| 📦 Created a bundle for openapi.yaml at stdout <test>ms. | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.