redocly-cli icon indicating copy to clipboard operation
redocly-cli copied to clipboard

fix: fix $ref resolution when used with $id

Open RomanHotsiy opened this issue 10 months ago • 5 comments

What/Why/How?

Potential fix for https://github.com/Redocly/redocly-cli/issues/1233

I'll fill in more details later.

Reference

https://github.com/Redocly/redocly-cli/issues/1233

Testing

Screenshots (optional)

Check yourself

  • [x] Code is linted
  • [ ] Tested with redoc/reference-docs/workflows (internal)
  • [ ] All new/updated code is covered with tests

Security

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

RomanHotsiy avatar Oct 05 '23 09:10 RomanHotsiy

⚠️ No Changeset found

Latest commit: 85f12c9a6838a50bcc27339c3970d878d2e417fc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Oct 05 '23 09:10 changeset-bot[bot]

Command Mean [s] Min [s] Max [s] Relative
redocly lint packages/core/src/benchmark/benches/rebilly.yaml 1.326 ± 0.014 1.314 1.352 1.00
redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml 1.334 ± 0.029 1.299 1.392 1.01 ± 0.02

github-actions[bot] avatar Oct 05 '23 09:10 github-actions[bot]

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟡 Statements 75.96% 4007/5275
🟡 Branches 65.97% 2140/3244
🟡 Functions 67.92% 648/954
🟡 Lines 76.16% 3756/4932

Test suite run success

638 tests passing in 93 suites.

Report generated by 🧪jest coverage report action from 85f12c9a6838a50bcc27339c3970d878d2e417fc

github-actions[bot] avatar Oct 05 '23 09:10 github-actions[bot]

Hi Roman

i pulled down your branch and added the file I used in the original issue. It's not working correctly and it appears a new error is reported with userData as an unused component. It seems to have resolved the userData schema, but it's not recognizing it as a used component in the main OAS description. The original error remains with Challenge and File unresolved and never used. Both of those components are inside the userData schema and should resolve inside the external schema.

From the fix/dollar-id-support branch

validating fcc-classroom-userdata-openapi.json...
fcc-classroom-userdata-openapi.json:
  253:42  error    no-unresolved-refs    Can't resolve $ref
  205:70  error    no-unresolved-refs    Can't resolve $ref
  227:21  warning  no-unused-components  Component: "Challenge" is never used.
  259:21  warning  no-unused-components  Component: "File" is never used.

https://api.freecodecamp.org/classroom/userData:
  153:13  warning  no-unused-components  Component: "userData" is never used.

fcc-classroom-userdata-openapi.json: validated in 101ms

❌ Validation failed with 2 errors and 3 warnings.

this is from the main branch 1.2.0

validating C:/Users/fiel/downloads/fcc-classroom-userdata-openapi.json...
..\downloads\fcc-classroom-userdata-openapi.json:
  251:46  error    no-unresolved-refs    Can't resolve $ref
  203:74  error    no-unresolved-refs    Can't resolve $ref
  225:25  warning  no-unused-components  Component: "Challenge" is never used.
  257:25  warning  no-unused-components  Component: "File" is never used.

jeremyfiel avatar Oct 05 '23 13:10 jeremyfiel

@jeremyfiel thanks for testing it. I suspected that 20min was not enough to fix this issue properly 😢 I'll take another try but not sure when.

RomanHotsiy avatar Oct 05 '23 15:10 RomanHotsiy