Skip to content

feat: add full Huma convention support to openapi-infer plugin#1

Merged
edu-diaz merged 1 commit intomainfrom
feat/huma-body-unwrapping
Mar 18, 2026
Merged

feat: add full Huma convention support to openapi-infer plugin#1
edu-diaz merged 1 commit intomainfrom
feat/huma-body-unwrapping

Conversation

@edu-diaz
Copy link
Contributor

@edu-diaz edu-diaz commented Mar 18, 2026

Summary

  • Unwrap Huma Body struct fields into proper {Type}Body schemas with recursive field parsing
  • Link routes to handler function signatures to generate requestBody and responses with $ref to Body schemas
  • Extract doc and minItems struct tags as OpenAPI description and minItems properties
  • Generate operationId (e.g. post-predict) and summary (e.g. Post predict) from method+path
  • Add standard Huma ErrorModel/ErrorDetail schemas and default error responses on all operations
  • Add additionalProperties: false, nullable arrays ["array", "null"], and numeric format mapping (float64double)
  • Filter non-API structs — only handler input/output types and their dependencies appear in schemas

- Unwrap Huma Body struct fields into proper {Type}Body schemas
- Link routes to handler function signatures for request/response body refs
- Extract doc struct tags as OpenAPI descriptions
- Extract minItems struct tags on array fields
- Generate operationId and summary from method+path
- Add ErrorModel/ErrorDetail schemas and default error responses
- Add additionalProperties: false on all Huma schemas
- Map Go numeric types to OpenAPI formats (float64→double, int64→int64)
- Render slice fields as nullable arrays ["array", "null"]
- Filter non-API structs (only handler input/output types included)
@edu-diaz edu-diaz merged commit 77c55c9 into main Mar 18, 2026
3 checks passed
@edu-diaz edu-diaz deleted the feat/huma-body-unwrapping branch March 18, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant