@@ -81,20 +81,10 @@ func (d Definition) ValidateImplementation(ctx context.Context, req DefinitionVa
81
81
paramNames := make (map [string ]int , len (d .Parameters ))
82
82
for pos , param := range d .Parameters {
83
83
parameterPosition := int64 (pos )
84
- name := param .GetName ()
85
- // If name is not set, add an error diagnostic, parameter names are mandatory.
86
- if name == "" {
87
- diags .AddError (
88
- "Invalid Function Definition" ,
89
- "When validating the function definition, an implementation issue was found. " +
90
- "This is always an issue with the provider and should be reported to the provider developers.\n \n " +
91
- fmt .Sprintf ("Function %q - Parameter at position %d does not have a name" , req .FuncName , pos ),
92
- )
93
- }
94
84
95
85
if paramWithValidateImplementation , ok := param .(fwfunction.ParameterWithValidateImplementation ); ok {
96
86
req := fwfunction.ValidateParameterImplementationRequest {
97
- Name : name ,
87
+ FunctionName : req . FuncName ,
98
88
ParameterPosition : & parameterPosition ,
99
89
}
100
90
resp := & fwfunction.ValidateParameterImplementationResponse {}
@@ -104,7 +94,9 @@ func (d Definition) ValidateImplementation(ctx context.Context, req DefinitionVa
104
94
diags .Append (resp .Diagnostics ... )
105
95
}
106
96
97
+ name := param .GetName ()
107
98
conflictPos , exists := paramNames [name ]
99
+
108
100
if exists && name != "" {
109
101
diags .AddError (
110
102
"Invalid Function Definition" ,
@@ -120,20 +112,9 @@ func (d Definition) ValidateImplementation(ctx context.Context, req DefinitionVa
120
112
}
121
113
122
114
if d .VariadicParameter != nil {
123
- name := d .VariadicParameter .GetName ()
124
- // If name is not set, add an error diagnostic, parameter names are mandatory.
125
- if name == "" {
126
- diags .AddError (
127
- "Invalid Function Definition" ,
128
- "When validating the function definition, an implementation issue was found. " +
129
- "This is always an issue with the provider and should be reported to the provider developers.\n \n " +
130
- fmt .Sprintf ("Function %q - The variadic parameter does not have a name" , req .FuncName ),
131
- )
132
- }
133
-
134
115
if paramWithValidateImplementation , ok := d .VariadicParameter .(fwfunction.ParameterWithValidateImplementation ); ok {
135
116
req := fwfunction.ValidateParameterImplementationRequest {
136
- Name : name ,
117
+ FunctionName : req . FuncName ,
137
118
}
138
119
resp := & fwfunction.ValidateParameterImplementationResponse {}
139
120
@@ -142,7 +123,9 @@ func (d Definition) ValidateImplementation(ctx context.Context, req DefinitionVa
142
123
diags .Append (resp .Diagnostics ... )
143
124
}
144
125
126
+ name := d .VariadicParameter .GetName ()
145
127
conflictPos , exists := paramNames [name ]
128
+
146
129
if exists && name != "" {
147
130
diags .AddError (
148
131
"Invalid Function Definition" ,
0 commit comments