MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / jsonResponse

Method jsonResponse

internal/httpapi/outbound.go:22–30  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
22func (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

Callers 3

errorEnvelopeResponseMethod · 0.95
registerOutboundMethod · 0.95
registerDomainsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected