File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
config/openapi/parameter/lint Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ const parametersTypeLint: LinterMeta = {
9
9
source : 'apilint' ,
10
10
message : 'Name must be unique among all parameters' ,
11
11
severity : DiagnosticSeverity . Error ,
12
- linterFunction : 'apilintPropertyUniqueValue ' ,
12
+ linterFunction : 'apilintPropertyUniqueSiblingValue ' ,
13
13
linterParams : [ [ 'parameters' ] , 'name' ] ,
14
14
marker : 'key' ,
15
15
markerTarget : 'name' ,
Original file line number Diff line number Diff line change @@ -795,6 +795,24 @@ export const standardLinterfunctions: FunctionItem[] = [
795
795
return true ;
796
796
} ,
797
797
} ,
798
+ {
799
+ functionName : 'apilintPropertyUniqueSiblingValue' ,
800
+ function : ( element , elementOrClasses , key ) => {
801
+ const value = toValue ( element ) ;
802
+ const elements = filter ( ( el ) => {
803
+ const classes : string [ ] = toValue ( el . getMetaProperty ( 'classes' , [ ] ) ) ;
804
+
805
+ return (
806
+ ( elementOrClasses . includes ( el . element ) ||
807
+ classes . every ( ( v ) => elementOrClasses . includes ( v ) ) ) &&
808
+ isObject ( el ) &&
809
+ el . hasKey ( key ) &&
810
+ toValue ( el . get ( key ) ) === value
811
+ ) ;
812
+ } , element . parent ?. parent ?. parent ) ;
813
+ return elements . length <= 1 ;
814
+ } ,
815
+ } ,
798
816
{
799
817
functionName : 'apilintChannelParameterExist' ,
800
818
function : ( element : Element ) : boolean => {
You can’t perform that action at this time.
0 commit comments