-
Notifications
You must be signed in to change notification settings - Fork 200
fix(project): add empty path check, throw error on unresolved path #2437
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
base: main
Are you sure you want to change the base?
Conversation
|
|
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const resolvedExtends = (node.extends || []) | ||
| .map((presetItem: string) => { | ||
| .map((presetItem, index) => { | ||
| if (typeof presetItem !== 'string' || !presetItem.trim()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's missing file path of where it happens
|
|
||
| const resolvedExtends = (node.extends || []) | ||
| .map((presetItem: string) => { | ||
| .map((presetItem, index) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's investigate if we can use reportUnresolvedRef in some place to resolve this issue.
https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/common/no-unresolved-refs.ts
| const exts = (node as any).extends; | ||
| if (!Array.isArray(exts)) return; | ||
|
|
||
| exts.forEach((item, index) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use regular for or for of
| } as PropType; | ||
| }, | ||
| } as PropType, | ||
| // extends: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this commented out?
|
| properties: configGovernanceProperties, | ||
| }; | ||
|
|
||
| const ConfigGovernanceList: NodeType = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, this name will likely be changed in #2488.
What/Why/How?
Currently extends property parser in config accepts not existing refs which causes builder to attempt to resolve those and throw hard error which could be hard to debug for user. I suggest adding more descriptive error message so that builder displays it
Reference
Issue
Check yourself
Security