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
returnfmt.Errorf("elicit schema property %q has unsupported type %q, only string, number, integer, and boolean are allowed", propName, propSchema.Type)
325
+
}
326
+
}
327
+
328
+
// validateElicitStringProperty validates string-type properties, including enums.
ifenumNamesSlice, ok:=enumNamesRaw.([]interface{}); ok {
342
+
iflen(enumNamesSlice) !=len(propSchema.Enum) {
343
+
returnfmt.Errorf("elicit schema property %q has %d enum values but %d enumNames, they must match", propName, len(propSchema.Enum), len(enumNamesSlice))
344
+
}
345
+
} else {
346
+
returnfmt.Errorf("elicit schema property %q has invalid enumNames type, must be an array", propName)
301
347
}
302
348
}
303
349
}
350
+
returnnil
351
+
}
352
+
353
+
// Validate format if specified - only specific formats are allowed
354
+
ifpropSchema.Format!="" {
355
+
allowedFormats:=map[string]bool{
356
+
"email": true,
357
+
"uri": true,
358
+
"date": true,
359
+
"date-time": true,
360
+
}
361
+
if!allowedFormats[propSchema.Format] {
362
+
returnfmt.Errorf("elicit schema property %q has unsupported format %q, only email, uri, date, and date-time are allowed", propName, propSchema.Format)
363
+
}
364
+
}
365
+
366
+
// Validate minLength constraint if specified
367
+
ifpropSchema.MinLength!=nil {
368
+
if*propSchema.MinLength<0 {
369
+
returnfmt.Errorf("elicit schema property %q has invalid minLength %d, must be non-negative", propName, *propSchema.MinLength)
370
+
}
304
371
}
305
-
372
+
373
+
// Validate maxLength constraint if specified
374
+
ifpropSchema.MaxLength!=nil {
375
+
if*propSchema.MaxLength<0 {
376
+
returnfmt.Errorf("elicit schema property %q has invalid maxLength %d, must be non-negative", propName, *propSchema.MaxLength)
377
+
}
378
+
// Check that maxLength >= minLength if both are specified
0 commit comments