Skip to content

Commit

Permalink
#1839: limit noRootFolder validation rule to types other than cloudpa…
Browse files Browse the repository at this point in the history
…ges, lists, automations, attributeSets
  • Loading branch information
JoernBerkefeld committed Nov 7, 2024
1 parent bf124ba commit fbb2afd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
3 changes: 1 addition & 2 deletions @types/lib/metadataTypes/Automation.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion @types/lib/metadataTypes/Automation.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion @types/lib/util/validations.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion lib/util/validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ export default async function validation(definition, item, targetDir, codeExtrac
try {
if (customRuleImport) {
customRules = customRuleImport
? await customRuleImport.validation(definition, item, targetDir, Util)
? await customRuleImport.validation(
definition,
item,
targetDir,
Util,
codeExtractItemArr
)
: {};
}
} catch (ex) {
Expand Down Expand Up @@ -67,6 +73,14 @@ export default async function validation(definition, item, targetDir, codeExtrac
// some types do not support folders
return true;
}
const doNotEvaluate = ['automation', 'attributeSet', 'list'];
if (
doNotEvaluate.includes(definition.type) ||
(definition.type === 'asset' && item?.assetType?.name === 'webpage')
) {
// this subtype is not visible in the interface and hence always technically sits in the root
return true;
}

return folderPath.includes('/');
},
Expand Down

0 comments on commit fbb2afd

Please sign in to comment.