Skip to content

Commit

Permalink
fix: fix for incorrect refs on join (#1400)
Browse files Browse the repository at this point in the history
* fix: fix for incorrect refs on join

* fix: fix e2e example snapshots to include check for proper prefix generation

* fix: Update .changeset/grumpy-rings-beam.md

Co-authored-by: Heather Cloward <[email protected]>

---------

Co-authored-by: Mateusz Lis <[email protected]>
Co-authored-by: Mateusz Lis <[email protected]>
Co-authored-by: Heather Cloward <[email protected]>
  • Loading branch information
4 people authored Feb 7, 2024
1 parent 4ab6e09 commit 4a913d6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/grumpy-rings-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@redocly/cli": patch
---

Fixed an issue where using the `--prefix-components-with-info-prop` option with the `join` command caused `$refs` to include duplicated prefixes.
3 changes: 3 additions & 0 deletions __tests__/join/prefix-components-with-info-prop/bar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ components:
some-property:
description: bar description
type: string
another-property:
description: description
$ref: '#/components/schemas/some-property'
3 changes: 3 additions & 0 deletions __tests__/join/prefix-components-with-info-prop/foo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ components:
some-property:
description: foo description
type: string
another-property:
description: description
$ref: '#/components/schemas/some-property'
6 changes: 6 additions & 0 deletions __tests__/join/prefix-components-with-info-prop/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,15 @@ components:
Foo Example OpenAPI 3 definition foo._some-property:
description: foo description
type: string
Foo Example OpenAPI 3 definition foo._another-property:
description: description
$ref: '#/components/schemas/Foo Example OpenAPI 3 definition foo._some-property'
Bar Example OpenAPI 3 definition._some-property:
description: bar description
type: string
Bar Example OpenAPI 3 definition._another-property:
description: description
$ref: '#/components/schemas/Bar Example OpenAPI 3 definition._some-property'
x-tagGroups:
- name: Foo Example OpenAPI 3 definition foo.
tags:
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ async function validateApi(
function crawl(object: any, visitor: any) {
if (!isObject(object)) return;
for (const key of Object.keys(object)) {
visitor(object, key);
visitor(object[key], key);
crawl(object[key], visitor);
}
}
Expand Down

1 comment on commit 4a913d6

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 76.1% 4302/5653
🟡 Branches 65.72% 2232/3396
🟡 Functions 68.81% 695/1010
🟡 Lines 76.31% 4045/5301

Test suite run success

699 tests passing in 100 suites.

Report generated by 🧪jest coverage report action from 4a913d6

Please sign in to comment.