Releases: SebastienMelki/sebuf
v0.6.0
What's New
This release includes Phases 1–5 of the v1.0 milestone, delivering major improvements to JSON encoding control, cross-generator consistency, and internal architecture.
Shared Annotations Package (Phase 2)
- Extracted shared annotations into a unified
internal/annotationspackage used by all four generators - Eliminates ~1,678 lines of duplicated annotation code
- Extensible convention-based API for adding new annotations
Cross-Generator Consistency (Phase 3)
- Content-Type response headers now correctly set on all HTTP responses
- OpenAPI int64/uint64 fields mapped to
stringtype per proto3 JSON spec - OpenAPI Error schema corrected to match
sebuf.http.Errorproto definition - Shared test proto infrastructure across generators
- Comprehensive consistency verification across go-http, go-client, ts-client, and openapiv3
JSON Primitive Encoding Control (Phase 4)
int64_encodingannotation: Control whether int64/uint64 fields serialize as strings (proto3 default) or numbersenum_encodingannotation: Control whether enums serialize as strings (names) or integersenum_valueannotation: Override individual enum value names in JSON output- Full support across all four generators (Go HTTP, Go client, TS client, OpenAPI)
Nullable & Empty Behavior (Phase 5)
nullableannotation: Mark fields as nullable (nullin JSON instead of omitted)empty_behaviorannotation: Control serialization of empty/zero-value fields (omit,include,null)- Full support across all four generators with cross-generator consistency tests
Bug Fixes (Phase 1)
- Fixed conditional
net/urlimport in go-client generator - Fixed cross-file unwrap field resolution within the same Go package
Full Changelog
v0.5.0
What's New
New Plugin: TypeScript HTTP Client Generator (protoc-gen-ts-client)
A brand new protoc plugin that generates fully typed TypeScript HTTP clients from protobuf service definitions:
- Full type safety — Typed interfaces for all messages, enums, and service methods
- Header helpers — Service-level and method-level header options generated from
service_headersandmethod_headersannotations - Query parameter encoding — Automatic encoding with null/undefined guards for GET requests
- Path parameter substitution — Dynamic URL path parameters from proto annotations
- Structured error handling —
ValidationError(with field-level violations) andApiErrortypes - Proto3 optional field support — Correct handling of optional fields
- Unwrap support — Map-value unwrap generates clean array types
Root-Level Unwrap
Extended the (sebuf.http.unwrap) annotation (introduced in v0.4.0) to support root-level unwrapping:
- Messages with a single unwrapped
mapfield serialize directly as the map (no wrapper object) - Messages with a single unwrapped
repeatedfield serialize directly as the array - Combined root + value unwrap for clean map-of-arrays serialization
- Supported across all generators: httpgen, clientgen, openapiv3, and tsclientgen
React Native Client Demo
Added examples/rn-client-demo/ — a complete React Native example app demonstrating usage of the generated TypeScript client in a mobile context.
Bug Fixes
- ts-client: Fixed map-value unwrap producing double-array types (
c595f89) - ts-client: Fixed query params crashing on undefined/null values (
8e75d8f) - test: Replaced broken absolute symlinks with relative paths (
87e1727)
Maintenance
- Bumped
github.com/pb33f/libopenapifrom 0.28.1 to 0.33.0 - Resolved golangci-lint issues across generators
- Expanded golden file test coverage for TypeScript client generator
- Updated project documentation for all four plugins
v0.4.0
What's New
New Feature: Unwrap Field Option
- Added
(sebuf.http.unwrap)field option for map values that should serialize as arrays in JSON - Support across all generators: httpgen, clientgen, and openapiv3
- Enables cleaner JSON serialization for map<string, repeated T> patterns
Other Changes
- Fixed generators for cross-package types
- Added market-data-unwrap example
- Documentation improvements for unwrap feature
- Lint fixes and test improvements
v0.3.0 - HTTP Client Generation
This release introduces the new protoc-gen-go-client plugin for generating type-safe HTTP clients from protobuf service definitions.
✨ New Features
protoc-gen-go-client
A new plugin that generates type-safe HTTP clients with:
- Functional options pattern for client configuration
- Per-call options for request customization
- JSON and binary protobuf content type support
- Automatic path parameter substitution
- Query parameter encoding for GET/DELETE methods
- Header helper options from
service_headers/method_headersannotations - Typed error handling with
ClientError
📦 Installation
go install github.com/SebastienMelki/sebuf/cmd/protoc-gen-go-client@v0.3.0🚀 Quick Start
// Create a client with options
client := api.NewUserServiceClient(
"http://localhost:8080",
api.WithUserServiceAPIKey("your-api-key"),
api.WithUserServiceHTTPClient(&http.Client{Timeout: 30 * time.Second}),
)
// Make requests with per-call options
user, err := client.CreateUser(ctx, req,
api.WithUserServiceHeader("X-Request-ID", "req-123"),
api.WithUserServiceCallContentType(api.ContentTypeProto),
)📚 Examples
New comprehensive client usage examples in examples/restful-crud/:
client_example.go- Basic CRUD operationsclient_error_handling.go- Error handling patternsclient_content_types.go- JSON vs binary protobufclient_per_call_options.go- Per-request customization
📖 Documentation
- Client Generation Guide - Complete documentation
- Getting Started - Updated with client plugin
Full Changelog: v0.2.1...v0.3.0
v0.2.1
Release v0.2.1
Changes since v0.2.0:
- Add test for structured response and fix linting issues
- Fix httpgen to pass err directly when it implements proto.Message
- Fix httpgen to preserve structure of proto.Message errors returned from handlers
v0.2.0
What's New
WithErrorHandler ServerOption (#74)
Added a new WithErrorHandler ServerOption that allows custom error response handling. The error handler can:
- Log errors without modifying the response
- Add custom headers to error responses (e.g.,
X-Error-ID,X-Request-ID) - Set custom HTTP status codes for specific error types
- Return custom
proto.Messageresponse bodies - Write directly to the response for full control
type ErrorHandler func(w http.ResponseWriter, r *http.Request, err error) proto.Message
services.RegisterUserServiceServer(server,
services.WithMux(mux),
services.WithErrorHandler(func(w http.ResponseWriter, r *http.Request, err error) proto.Message {
log.Printf("Error: %v", err)
w.Header().Set("X-Error-ID", uuid.NewString())
var notFound *ErrNotFound
if errors.As(err, ¬Found) {
w.WriteHeader(http.StatusNotFound)
return &models.NotFoundError{
ResourceType: notFound.ResourceType,
ResourceId: notFound.ResourceID,
Message: err.Error(),
}
}
return nil // Use default error response
}),
)New Example
Added examples/error-handler/ demonstrating all error handler patterns:
- LoggingErrorHandler - log errors without modifying response
- HeaderErrorHandler - add custom headers
- StatusCodeErrorHandler - set custom HTTP status codes
- CustomBodyErrorHandler - return custom proto.Message responses
- FullControlErrorHandler - write directly to response
- CombinedErrorHandler - combines all patterns
Other Changes
- docs: fix stale references and update documentation accuracy
- fix(examples): update buf lint config for all examples
- fix(proto): update buf lint config to use STANDARD category
Full Changelog
v0.1.0
What's New
Features
- HTTP verb routing and parameter binding - Full support for GET, POST, PUT, DELETE, PATCH methods with automatic parameter binding
- HTTP method and query parameter annotations - New proto annotations for defining HTTP methods and query parameters
- OpenAPI HTTP verb and parameter support - Generated OpenAPI specs now include full HTTP verb and parameter documentation
- 4 new feature showcase examples - Comprehensive examples demonstrating all major features
Improvements
- Comprehensive unit tests for HTTP handler generator
- Unit tests for HTTP annotation functions in OpenAPI generator
- Resolved all golangci-lint issues
- Updated dependencies (protobuf, yaml, GitHub Actions)
Bug Fixes
- Remove proto3 optional to avoid warnings in examples
Dependencies
- Bump actions/upload-artifact from 5 to 6
- Bump actions/download-artifact from 5 to 7
- Bump actions/checkout from 5 to 6
- Bump golangci/golangci-lint-action from 8 to 9
- Bump protobuf dependencies
- Bump go.yaml.in/yaml/v4 to 4.0.0-rc.3