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
feat: add regex validation to server name in API types
- Add pattern validation (^[^/]+/[^/]+$) to ensure exactly one slash
- Update tests to expect HTTP 422 for validation errors (correct status)
- Remove unnecessary error handling complexity in publish handler
- This makes the validation visible in API documentation
Following @domdomegg's suggestion to align API specs with implementation.
Co-Authored-By: Adam Jones <[email protected]>
return"", fmt.Errorf("server namespace '%s' contains invalid characters: only alphanumeric characters, dots (.) and hyphens (-) are allowed", parts[0])
423
+
}
424
+
425
+
if!namePattern.MatchString(parts[1]) {
426
+
return"", fmt.Errorf("server name '%s' contains invalid characters: only alphanumeric characters, dots (.), underscores (_) and hyphens (-) are allowed", parts[1])
0 commit comments