You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
errs=errs.Also(errs, apis.ErrGeneric(fmt.Sprintf("feature flag %s should be set to true to use Enum", config.EnableParamEnum), "").ViaFieldKey("params", p.Name))
157
+
}
158
+
ifp.Type!=ParamTypeString {
159
+
errs=errs.Also(apis.ErrGeneric("enum can only be set with string type param", "").ViaFieldKey("params", p.Name))
160
+
}
161
+
fordup:=rangefindDups(p.Enum) {
162
+
errs=errs.Also(apis.ErrGeneric(fmt.Sprintf("parameter enum value %v appears more than once", dup), "").ViaFieldKey("params", p.Name))
142
163
}
143
-
seen.Insert(n)
144
-
}
145
-
forn:=rangedups {
146
-
errs=errs.Also(apis.ErrGeneric("parameter appears more than once", "").ViaFieldKey("params", n))
147
164
}
148
165
returnerrs
149
166
}
150
167
168
+
// findDups returns the duplicate element in the given slice
169
+
funcfindDups(vals []string) sets.String {
170
+
seen:= sets.String{}
171
+
dups:= sets.String{}
172
+
for_, val:=rangevals {
173
+
ifseen.Has(val) {
174
+
dups.Insert(val)
175
+
}
176
+
seen.Insert(val)
177
+
}
178
+
returndups
179
+
}
180
+
151
181
// Param declares an ParamValues to use for the parameter called name.
Copy file name to clipboardexpand all lines: pkg/apis/pipeline/v1/swagger.json
+8
Original file line number
Diff line number
Diff line change
@@ -343,6 +343,14 @@
343
343
"description": "Description is a user-facing description of the parameter that may be used to populate a UI.",
344
344
"type": "string"
345
345
},
346
+
"enum": {
347
+
"description": "Enum declares a set of allowed param input values for tasks/pipelines that can be validated. If Enum is not set, no input validation is performed for the param.",
348
+
"type": "array",
349
+
"items": {
350
+
"type": "string",
351
+
"default": ""
352
+
}
353
+
},
346
354
"name": {
347
355
"description": "Name declares the name by which a parameter is referenced.",
0 commit comments