You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
strict-server: a form response reached through $ref is encoded under an empty field name #2586
Under strict-server, an operation that reaches a components/responses entry through $ref (fixed status code, no headers) embeds the reusable envelope in its own response type:
For application/x-www-form-urlencoded, the visitor passes that wrapper to runtime.MarshalForm:
form, err:=runtime.MarshalForm(response, nil)
The embedded field has no form or json tag, so MarshalForm writes its fields under an empty name. A body of {value: "x"} goes on the wire as %5Bvalue%5D=x ([value]=x) instead of value=x. The JSON path already handles this case by encoding the embedded envelope (response.ThingJSONResponse); the form path does not.
Found while reviewing #2514. It reproduces on main, in every strict flavor (std-http, chi, gorilla, echo, echo5, gin, fiber, fiber-v3, iris), and for cross-package $refs through import-mapping too.
Return GetThing200FormdataResponse{ThingFormdataResponse: ThingFormdataResponse(Example{Value: &v})} with v := "x":
Observed body: %5Bvalue%5D=x
Expected body: value=x, which is what the same response declared inline produces.
Notes
Only form responses are affected. Text and multipart $ref responses are redeclared as the operation's type rather than embedded, and header-bearing or non-fixed-status responses already marshal response.Body.
The generated output has never produced a correct body, so fixing it doesn't change any output that works today.
Activity