File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -807,17 +807,23 @@ export default class ConfigValidator implements IConfigValidator {
807807 if ( typeof condition !== 'object' ) {
808808 return ;
809809 }
810+ const relatedColumn = res . columns . find ( ( c ) => c . name === field ) ;
811+ if ( ! relatedColumn ) {
812+ const similar = suggestIfTypo ( res . columns . map ( ( c ) => c . name ) , field ) ;
813+ errors . push ( `Resource "${ res . resourceId } " column "${ column . name } " has showIf on unknown column "${ field } ". ${ similar ? `Did you mean "${ similar } "?` : '' } ` ) ;
814+ return ;
815+ }
810816 if ( "$in" in condition && ! Array . isArray ( condition . $in ) ) {
811817 errors . push ( `Resource "${ res . resourceId } " column "${ column . name } " has showIf with $in that is not an array` ) ;
812818 }
813819 if ( "$nin" in condition && ! Array . isArray ( condition . $nin ) ) {
814820 errors . push ( `Resource "${ res . resourceId } " column "${ column . name } " has showIf with $nin that is not an array` ) ;
815821 }
816- if ( "$includes" in condition && ! column . isArray ) {
817- errors . push ( `Resource "${ res . resourceId } " has showIf with $includes on non-array column "${ column . name } "` ) ;
822+ if ( "$includes" in condition && ! relatedColumn . isArray ?. enabled ) {
823+ errors . push ( `Resource "${ res . resourceId } " has showIf with $includes on non-array column "${ relatedColumn . name } "` ) ;
818824 }
819- if ( "$nincludes" in condition && ! column . isArray ) {
820- errors . push ( `Resource "${ res . resourceId } " has showIf with $nincludes on non-array column "${ column . name } "` ) ;
825+ if ( "$nincludes" in condition && ! relatedColumn . isArray ?. enabled ) {
826+ errors . push ( `Resource "${ res . resourceId } " has showIf with $nincludes on non-array column "${ relatedColumn . name } "` ) ;
821827 }
822828 } ) ;
823829 }
You can’t perform that action at this time.
0 commit comments