feat: add OpenAPI tags for improved SDK generation and API organization (#655)
## Summary Adds OpenAPI tags to improve SDK generation and API documentation organization, as discussed in #644. ## Changes - **Go Code**: Define tag metadata (name + description) in `internal/api/router/router.go` using Huma's `api.OpenAPI().Tags` - **Reference Spec**: Update `docs/reference/api/openapi.yaml` to match the generated spec - **Tags Added**: servers, publish, auth, admin, health, ping ## Benefits - ✅ Improved SDK generation with proper service grouping (e.g., `serversService`, `publishService`) - ✅ Better API documentation organization in Scalar UI, Swagger UI, and other tools - ✅ Code-first approach ensures reference spec stays in sync via compliance tests ## Testing - ✅ Compliance test passes: `go test -v ./internal/api -run TestOpenAPIEndpointCompliance` - ✅ All 4 reference endpoints verified as implemented - ✅ TypeScript SDK regenerated successfully with proper tag-based grouping ## Related Closes #644
This commit is contained in:
parent
1a7cd97099
commit
cce5e5df46
1 changed files with 24 additions and 2 deletions
|
|
@ -139,6 +139,18 @@ func NewHumaAPI(cfg *config.Config, registry service.RegistryService, mux *http.
|
|||
// Create a new API using humago adapter for standard library
|
||||
api := humago.New(mux, humaConfig)
|
||||
|
||||
// Add OpenAPI tag metadata with descriptions
|
||||
api.OpenAPI().Tags = []*huma.Tag{
|
||||
{
|
||||
Name: "servers",
|
||||
Description: "Operations for discovering and retrieving MCP servers",
|
||||
},
|
||||
{
|
||||
Name: "publish",
|
||||
Description: "Operations for publishing MCP servers to the registry",
|
||||
},
|
||||
}
|
||||
|
||||
// Add metrics middleware with options
|
||||
api.UseMiddleware(MetricTelemetryMiddleware(metrics,
|
||||
WithSkipPaths("/health", "/metrics", "/ping", "/docs"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue