jsonResponse builds an extra OpenAPI response entry for an operation whose handler can return a non-default status with the given body schema. The schema is registered (and reused via $ref) in the API's component registry, so the declared response stays in lockstep with the Go type — no hand-edits t
(bodyType reflect.Type, schemaName, description string)
| 20 | // to api/openapi.yaml. Used to document the 202 (HITL hold) / 412 / 409 codes |
| 21 | // the typed handlers emit but Huma can't infer from the single DefaultStatus. |
| 22 | func (s *Server) jsonResponse(bodyType reflect.Type, schemaName, description string) *huma.Response { |
| 23 | schema := s.API.OpenAPI().Components.Schemas.Schema(bodyType, true, schemaName) |
| 24 | return &huma.Response{ |
| 25 | Description: description, |
| 26 | Content: map[string]*huma.MediaType{ |
| 27 | "application/json": {Schema: schema}, |
| 28 | }, |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | // errorEnvelopeResponse is the generic `default` error response (ErrorEnvelope). |
| 33 | // Huma auto-adds it to every operation, but declaring a custom `Responses` map |
no outgoing calls
no test coverage detected