Skip to content
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

fix: join command failing on null values with --prefix-components-with-info-prop option #1444

Merged
merged 8 commits into from
Feb 19, 2024

Conversation

tatomyr
Copy link
Contributor

@tatomyr tatomyr commented Feb 19, 2024

What/Why/How?

Since 1.9.0 join fails when used with the --prefix-components-with-info-prop option and a schema contains null value.

This PR resolves the issue by moving the crawl visitor out of the loop.

Also, did a small refactoring of split command (reusing shared things with join, types correction).

Reference

Fixes #1440

Testing

Screenshots (optional)

Has code been changed?

  • Tested with redoc/reference-docs/workflows (internal)
  • All new/updated code is covered with tests

Security

  • Security impact of change has been considered
  • Code follows company security practices and guidelines

Copy link

changeset-bot bot commented Feb 19, 2024

🦋 Changeset detected

Latest commit: ddc3e2b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@redocly/cli Patch
@redocly/openapi-core Patch

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

Copy link
Contributor

github-actions bot commented Feb 19, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 76.92% 4450/5785
🟡 Branches 67.03% 2356/3515
🟡 Functions 70.22% 724/1031
🟡 Lines 77.11% 4181/5422
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / index.ts
67.48% 58.4% 85.19% 71.05%

Test suite run success

713 tests passing in 101 suites.

Report generated by 🧪jest coverage report action from ddc3e2b

Copy link
Contributor

github-actions bot commented Feb 19, 2024

Command Mean [ms] Min [ms] Max [ms] Relative
redocly lint packages/core/src/benchmark/benches/rebilly.yaml 969.4 ± 9.2 957.5 987.5 1.00
redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml 1016.7 ± 12.8 991.2 1032.3 1.05 ± 0.02

@tatomyr tatomyr force-pushed the fix/join-failing-with-prefix-components-with-info-prop branch from 40a972c to d2516fd Compare February 19, 2024 08:38
@tatomyr tatomyr self-assigned this Feb 19, 2024
@tatomyr tatomyr requested a review from IgorKarpiuk February 19, 2024 10:29
@tatomyr tatomyr marked this pull request as ready for review February 19, 2024 10:57
@tatomyr tatomyr requested review from a team as code owners February 19, 2024 10:57
Copy link
Contributor

@lornajane lornajane left a comment

Choose a reason for hiding this comment

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

Minor grammatical update.

Might be worth adding a comment about why this was the answer? I see the bug report, I see some changes to dependencies, but it's not obvious to me (or future-us) why this is the fix.

.changeset/spotty-pets-doubt.md Outdated Show resolved Hide resolved
Co-authored-by: Lorna Jane Mitchell <github@lornajane.net>
@tatomyr tatomyr requested a review from lornajane February 19, 2024 11:04
@tatomyr
Copy link
Contributor Author

tatomyr commented Feb 19, 2024

@lornajane updated the description.

Copy link
Contributor

@lornajane lornajane left a comment

Choose a reason for hiding this comment

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

changeset is good

@tatomyr tatomyr requested a review from IgorKarpiuk February 19, 2024 15:16
@tatomyr tatomyr merged commit 27f570a into main Feb 19, 2024
30 checks passed
@tatomyr tatomyr deleted the fix/join-failing-with-prefix-components-with-info-prop branch February 19, 2024 16:51
.split('/')
.map((name: string, i: number, arr: []) => {
.map((name, i, arr) => {
return arr.length - 1 === i && !name.includes(componentsPrefix)

Choose a reason for hiding this comment

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

This check would better be !name.startsWith(componentsPrefix) so that if someone coincidentally uses the component prefix somewhere inside the name, the prefix is added nonetheless

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Join with --prefix-components-with-info-prop does not produce any output since version 1.9.0
4 participants