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: resolve API alias paths correctly for config files located outside the root folder #1823

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

tatomyr
Copy link
Contributor

@tatomyr tatomyr commented Dec 11, 2024

What/Why/How?

A bunch of fixes for problems I discovered while investigating other issues.

  • Fixed an issue where an API alias's root path might be resolved incorrectly for configuration files located outside the root folder.
    E.g., suppose we have this config file: <starting-folder>/nested/redocly.yaml:
apis: 
   alias@v1: 
     root: ./openapi.yaml

When running redocly bundle --config nested/redocly.yaml alias@v1, it would search for <starting-folder>/openapi.yaml instead of <starting-folder>/nested/openapi.yaml.
(See the related snapshot).
The related changes are scoped to packages/cli/src/utils/miscellaneous.ts

Screenshot 2024-12-11 at 17 31 29

Reference

Resolves #1351

Testing

Tested internally: https://github.com/Redocly/redocly/pull/12496

Screenshots (optional)

Check yourself

  • Code changed? - Tested with redoc/reference-docs/workflows (internal)
  • All new/updated code is covered with tests
  • New package installed? - Tested in different environments (browser/node)

Security

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

Copy link

changeset-bot bot commented Dec 11, 2024

🦋 Changeset detected

Latest commit: 7d2b034

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 Dec 11, 2024

Command Mean [ms] Min [ms] Max [ms] Relative
redocly lint packages/core/src/benchmark/benches/rebilly.yaml 989.2 ± 17.9 956.8 1011.0 1.02 ± 0.02
redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml 970.8 ± 13.5 953.1 992.4 1.00

Copy link
Contributor

github-actions bot commented Dec 11, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 78.62% 5049/6422
🟡 Branches 67.22% 2053/3054
🟡 Functions 73.16% 834/1140
🟡 Lines 78.91% 4762/6035
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / miscellaneous.ts
68.29%
57.85% (-1.98% 🔻)
71.7% 68.05%
🔴
... / login.ts
35.71% (-5.95% 🔻)
0% 0%
35.71% (-5.95% 🔻)

Test suite run success

834 tests passing in 121 suites.

Report generated by 🧪jest coverage report action from 7d2b034

@tatomyr tatomyr self-assigned this Dec 12, 2024
@tatomyr tatomyr force-pushed the fix/resolve-api-root-correctly branch from ad6f4f3 to 7d2b034 Compare December 17, 2024 16:30
@tatomyr tatomyr marked this pull request as ready for review December 17, 2024 16:40
@tatomyr tatomyr requested review from a team as code owners December 17, 2024 16:40
@tatomyr tatomyr requested a review from RomanHotsiy December 17, 2024 16:40
@Marshevskyy Marshevskyy merged commit 4092575 into main Dec 18, 2024
41 checks passed
@Marshevskyy Marshevskyy deleted the fix/resolve-api-root-correctly branch December 18, 2024 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with path resolving in the configuration file
4 participants