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

feat: resolve refs in config #1345

Merged
merged 21 commits into from
Dec 21, 2023
Merged

feat: resolve refs in config #1345

merged 21 commits into from
Dec 21, 2023

Conversation

tatomyr
Copy link
Contributor

@tatomyr tatomyr commented Dec 1, 2023

What/Why/How?

This allows using $ref in config files like this:

# redocly.yaml
seo:
  $ref: seo.yaml
rbac: 
  $ref: rbac.yaml

⚠️ When using the push command with $ref's in config file, user should explicitly upload all referenced files in the config using --files option.

  • Resolve $refs in config files
  • Add basic linting support
  • Extend config node types to be linted
  • Add basic support for VS Code extension
  • Check compatibility with other tools (scout and portal)
  • Look into Error resolving $ref pointer redoc#740 (comment) (is not related; better to be handled in a separate MR)

Also fixed a couple of issues with resolving refs and formatting the output.

Reference

Resolves #1219

Testing

Screenshots (optional)

Check yourself

  • Code is linted
  • 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

@tatomyr tatomyr self-assigned this Dec 1, 2023
Copy link

changeset-bot bot commented Dec 1, 2023

🦋 Changeset detected

Latest commit: 0231d42

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

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

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

@tatomyr tatomyr force-pushed the test/refs-in-config branch from a893d88 to d7fc2eb Compare December 1, 2023 12:49
Copy link
Contributor

github-actions bot commented Dec 1, 2023

Command Mean [s] Min [s] Max [s] Relative
redocly lint packages/core/src/benchmark/benches/rebilly.yaml 1.064 ± 0.029 1.037 1.121 1.00
redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml 1.070 ± 0.020 1.035 1.102 1.01 ± 0.03

Copy link
Contributor

github-actions bot commented Dec 1, 2023

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 76.31% 4100/5373
🟡 Branches 66.29% 2183/3293
🟡 Functions 68.42% 663/969
🟡 Lines 76.51% 3847/5028
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡 core/src/utils.ts 77.6% 63.64% 77.27% 77.59%
🟢
... / config-resolvers.ts
83.43% 73.36% 100% 84.05%

Test suite run success

653 tests passing in 94 suites.

Report generated by 🧪jest coverage report action from 0231d42

@tatomyr tatomyr force-pushed the test/refs-in-config branch from 0fa4b53 to 7983be2 Compare December 18, 2023 14:22
@tatomyr tatomyr marked this pull request as ready for review December 18, 2023 14:43
@tatomyr tatomyr requested a review from a team as a code owner December 18, 2023 14:43
@tatomyr tatomyr removed the request for review from a team December 18, 2023 14:43
@tatomyr tatomyr requested review from RomanHotsiy and a team December 18, 2023 14:43
Copy link
Contributor

@IgorKarpiuk IgorKarpiuk left a comment

Choose a reason for hiding this comment

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

LGTM

Co-authored-by: Heather Cloward <heathercloward@gmail.com>
@tatomyr
Copy link
Contributor Author

tatomyr commented Dec 21, 2023

The link checker started failing for some strange reason (Dockerhub responds with 429 status despite being available from the browser), even on the main branch. I'm not sure what caused that, but it's not related to the changes.
So I'm going ahead and merging this.

@tatomyr tatomyr merged commit d44ad9e into main Dec 21, 2023
28 of 29 checks passed
@tatomyr tatomyr deleted the test/refs-in-config branch December 21, 2023 13:32
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.

Add $ref support in redocly.yaml
3 participants