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(errors): add structured validation error proto definitions
- Add ValidationError and FieldViolation messages
- Support field-level validation error details
- Enable JSON/protobuf serialization for error responses
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(httpgen): implement structured validation error responses
- Add writeValidationErrorResponse() for content-type aware error serialization
- Add writeValidationError() to convert protovalidate errors to ValidationError
- Update validateHeaders() to return ValidationError directly
- Replace plain text http.Error() calls with structured error responses
- Support both JSON and protobuf error response formats based on content-type
- Extract field paths from protovalidate violations for detailed error reporting
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* build(proto): add errors.proto to proto generation target
- Include errors.proto in protoc compilation
- Add proper go_opt mapping for errors.proto
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor(examples): simplify simple-api by removing admin service
- Remove admin.proto and admin_service.proto
- Focus example on core user service functionality
- Reduce complexity for testing and demonstration
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* build(examples): use local sebuf module with replace directive
- Add replace directive to use local sebuf for testing
- Ensure examples use latest local changes during development
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* chore(proto): regenerate proto files with latest protoc
- Update annotations.pb.go and headers.pb.go
- Regenerated with protoc v6.32.0
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs(validation): update error handling for structured responses
- Document ValidationError message structure with field violations
- Update error examples to show JSON response format
- Add examples of multiple validation failures
- Update features list to include structured errors and content-type awareness
- Show both header and body validation error responses
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs(http-generation): update for structured validation errors
- Update generated validation code examples to show ValidationError returns
- Modify header validation examples to show JSON error responses
- Add structured errors to features list
- Update curl examples with proper JSON error format
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs(examples): update simple-api README for structured errors
- Update validation error examples to show JSON response format
- Add examples of multiple validation failures
- Remove references to deleted AdminService
- Simplify OpenAPI documentation references
- Add structured error responses to features list
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: add structured error responses to main feature list
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(openapiv3): add ValidationError schemas and 400 responses
- Add ValidationError and FieldViolation schemas to OpenAPI components
- Include 400 validation error responses in all method specifications
- Provide comprehensive error documentation for API consumers
- Support both request body and header validation error reporting
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* style(httpgen): improve function signature formatting
- Format long function signature lines for better readability
- Maintain consistent code style across generator functions
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor(httpgen): break down long functions to fix linting issues
- Split generateErrorResponseFunctions into smaller helper functions
- Split generateValidateHeadersFunction into smaller helper functions
- Fix funlen linting violations (functions > 50 statements)
- Maintain same generated code behavior with improved readability
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* test(openapiv3): update golden files for ValidationError schemas
- Add FieldViolation and ValidationError schemas to all golden files
- Include 400 validation error responses in method specifications
- Update both YAML and JSON golden file formats
- Reflect new OpenAPI generator behavior for validation errors
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* chore(test): remove temporary golden file artifacts
- Remove .generated files created during golden file testing
- Clean up test artifacts that shouldn't be committed
- These files are created during UPDATE_GOLDEN test runs
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Revert "chore(test): remove temporary golden file artifacts"
This reverts commit d6db39d.
* chore(test): remove .generated test artifacts from git history
- Remove temporary .generated files created during golden file testing
- These files are test artifacts and shouldn't be committed
- They are created during UPDATE_GOLDEN test runs for comparison
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* chore: add .generated files to .gitignore
- Prevent temporary .generated test files from being committed
- These files are created during golden file testing for comparison
- Should be automatically cleaned up after test runs
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
- ✅ **Structured error responses** - JSON or protobuf ValidationError with field-level details
69
+
- ✅ **Content-type aware** - Error format matches client's requested content type
69
70
- ✅ **Fail-fast validation** - Headers validated before body for efficiency
70
71
71
72
## Request Body Validation Rules
@@ -291,48 +292,121 @@ service SecureAPI {
291
292
292
293
## Error Handling
293
294
294
-
When validation fails, sebuf returns an HTTP 400 Bad Request with the validation error message. Headers are validated before the request body.
295
+
When validation fails, sebuf returns an HTTP 400 Bad Request with a structured error response. The response format respects the client's `Content-Type` header, returning either JSON or protobuf. Headers are validated before the request body.
296
+
297
+
### Structured Error Response Format
298
+
299
+
Validation errors are returned as a `ValidationError` message containing field-level violations:
300
+
301
+
```protobuf
302
+
message ValidationError {
303
+
repeated FieldViolation violations = 1;
304
+
}
305
+
306
+
message FieldViolation {
307
+
string field = 1; // Field that failed validation
308
+
string description = 2; // Description of the violation
309
+
}
310
+
```
295
311
296
312
### Header Validation Errors
297
313
298
314
```bash
299
315
# Missing required header
300
-
curl -X POST /api/users -d '{"name": "John"}'
316
+
curl -X POST /api/users \
317
+
-H "Content-Type: application/json" \
318
+
-d '{"name": "John"}'
301
319
# Returns: 400 Bad Request
302
-
# Body: "Missing required header: X-API-Key"
320
+
# Body:
321
+
{
322
+
"violations": [{
323
+
"field": "X-API-Key",
324
+
"description": "required header 'X-API-Key' is missing"
0 commit comments