redocly-cli
redocly-cli copied to clipboard
feat: handle error if api does not exist
What/Why/How?
Add error handle in cases if definition does not exist. Previously cli throw native error

Also there was and issue if root of apis provided as link. See #849 and #850
Reference
Closes #849, #850
Testing
Screenshots (optional)
Example with run redocly lint resources/pets.yaml not-exist.yaml

Check yourself
- [ ] Code is linted
- [ ] Tested with redoc/reference-docs/workflows
- [ ] All new/updated code is covered with tests
Security
- [ ] Security impact of change has been considered
- [ ] Code follows company security practices and guidelines
Coverage report
St.:grey_question: |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟡 | Statements | 73.56% | 3367/4577 |
| 🟡 | Branches | 65.25% | 1902/2915 |
| 🟡 | Functions | 66.09% | 571/864 |
| 🟡 | Lines | 73.59% | 3129/4252 |
Show files with reduced coverage 🔻
St.:grey_question: |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| 🟢 | ... / config-resolvers.ts |
84% | 74.49% | 100% | 84.72% |
| 🟢 | core/src/index.ts | 100% | 100% | 7.84% | 100% |
| 🟡 | ... / utils.ts |
69.77% | 38.46% | 83.33% (-2.38% 🔻) |
71.43% |
Test suite run success
521 tests passing in 84 suites.
Report generated by 🧪jest coverage report action from 73edb03e1625aeb6ec0e0577b6f08bb6e8ff10ab
Please check if the logic covers the extends functionality: https://redocly.com/docs/cli/configuration/#extends-list
And check it covers the plugins paths too.
And check it covers the
pluginspaths too.
Please check if the logic covers the
extendsfunctionality: https://redocly.com/docs/cli/configuration/#extends-list
This check do not handle both of those cases. We can add this check, but it depends if we want to proceed in cases if plugin or config does not exist. I think we should proceed with same behaviour as it is work now ( Throw error and stop executing but with more efficient error)
cc @adamaltman @tatomyr
I believe we should also cover plugins and extends. To me there's sense to proceed with a config which is trying to extend from non-existing config or a plugin. I believe we should add errors for those cases as well.
Yes, with a friendly error message.