fix: getting cookie in fiber middleware#1751
Open
nikitaRykhlov wants to merge 1 commit intooapi-codegen:mainfrom
Open
fix: getting cookie in fiber middleware#1751nikitaRykhlov wants to merge 1 commit intooapi-codegen:mainfrom
nikitaRykhlov wants to merge 1 commit intooapi-codegen:mainfrom
Conversation
mromaszewicz
added a commit
to mromaszewicz/oapi-codegen
that referenced
this pull request
Mar 27, 2026
…uters Audit and fix parameter binding in all 8 server code generation templates (Echo v4, Echo v5, Chi, Gin, Gorilla, Iris, Fiber, stdhttp) to ensure consistent, correct handling of path, query, header, and cookie parameters across all OpenAPI styles and types. Template fixes: - Add missing ParamLocation to path params (Gin, Fiber, Gorilla) and cookie params (Chi, Gin, Fiber, Gorilla, stdhttp) so the runtime applies correct URL escaping per location - Add missing Type/Format fields to Echo v5 path, header, and cookie params, and upgrade its query binding to BindQueryParameterWithOptions - Fix required deepObject query params rejected by a spurious pre-check in Chi, Gin, Gorilla, Fiber, and stdhttp templates - Fix Gin, Iris, and Fiber using query param getters instead of path param getters for content-based (passthrough/JSON) path parameters - Fix Iris cookie params calling nonexistent ctx.Cookie() (now ctx.GetCookie()) and query params calling ctx.QueryParam() (now ctx.URLParam()) - Fix Fiber cookie params redeclaring var in a loop (now block-scoped) - Fix Fiber not URL-decoding path param values for passthrough/JSON - Add _ = err to suppress unused variable when only passthrough path params exist (Chi, Gin, Gorilla, Iris, Fiber, stdhttp) Multi-router parameter roundtrip test: - New test infrastructure under internal/test/parameters/ with per-router subdirectories (echo, chi, gin, gorilla, iris, fiber, stdhttp) plus a shared client package - Each router's server echoes received parameters back as JSON; the shared testImpl sends requests via the generated client and verifies the JSON response matches the original values - Generated files isolated in gen/ subdirectories so go generate works even when generated code has compilation errors - Echo v5 in its own module (Go 1.25+) with version-guarded Makefile - Covers all OpenAPI parameter styles (simple, label, matrix, form, deepObject) x types (primitive, array, object) x explode flags across path, query, header, and cookie locations Skipped tests pending external changes: - spaceDelimited and pipeDelimited query styles: runtime does not yet support binding these styles (oapi-codegen/runtime#116) - stdhttp roundtrip: stdlib ServeMux cannot register path wildcards starting with a digit like {1param} (oapi-codegen#2306) Closes: oapi-codegen#777, oapi-codegen#1752 Obsoletes: oapi-codegen#1751, oapi-codegen#2062 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mromaszewicz
added a commit
to mromaszewicz/oapi-codegen
that referenced
this pull request
Mar 27, 2026
Audit and fix parameter binding in all 8 server code generation templates (Echo v4, Echo v5, Chi, Gin, Gorilla, Iris, Fiber, stdhttp) to ensure consistent, correct handling of path, query, header, and cookie parameters across all OpenAPI styles and types. Template fixes: - Add missing ParamLocation to path params (Gin, Fiber, Gorilla) and cookie params (Chi, Gin, Fiber, Gorilla, stdhttp) so the runtime applies correct URL escaping per location - Add missing Type/Format fields to Echo v5 path, header, and cookie params, and upgrade its query binding to BindQueryParameterWithOptions - Fix required deepObject query params rejected by a spurious pre-check in Chi, Gin, Gorilla, Fiber, and stdhttp templates - Fix Gin, Iris, and Fiber using query param getters instead of path param getters for content-based (passthrough/JSON) path parameters - Fix Iris cookie params calling nonexistent ctx.Cookie() (now ctx.GetCookie()) and query params calling ctx.QueryParam() (now ctx.URLParam()) - Fix Fiber cookie params redeclaring var in a loop (now block-scoped) - Fix Fiber not URL-decoding path param values for passthrough/JSON - Add _ = err to suppress unused variable when only passthrough path params exist (Chi, Gin, Gorilla, Iris, Fiber, stdhttp) Multi-router parameter roundtrip test: - New test infrastructure under internal/test/parameters/ with per-router subdirectories (echo, chi, gin, gorilla, iris, fiber, stdhttp) plus a shared client package - Each router's server echoes received parameters back as JSON; the shared testImpl sends requests via the generated client and verifies the JSON response matches the original values - Generated files isolated in gen/ subdirectories so go generate works even when generated code has compilation errors - Echo v5 in its own module (Go 1.25+) with version-guarded Makefile - Covers all OpenAPI parameter styles (simple, label, matrix, form, deepObject) x types (primitive, array, object) x explode flags across path, query, header, and cookie locations Skipped tests pending external changes: - spaceDelimited and pipeDelimited query styles: runtime does not yet support binding these styles (oapi-codegen/runtime#116) - stdhttp roundtrip: stdlib ServeMux cannot register path wildcards starting with a digit like {1param} (oapi-codegen#2306) Closes: oapi-codegen#777, oapi-codegen#1752 Obsoletes: oapi-codegen#1751, oapi-codegen#2062 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mromaszewicz
added a commit
to mromaszewicz/oapi-codegen
that referenced
this pull request
Mar 27, 2026
Audit and fix parameter binding in all 8 server code generation templates (Echo v4, Echo v5, Chi, Gin, Gorilla, Iris, Fiber, stdhttp) to ensure consistent, correct handling of path, query, header, and cookie parameters across all OpenAPI styles and types. Template fixes: - Add missing ParamLocation to path params (Gin, Fiber, Gorilla) and cookie params (Chi, Gin, Fiber, Gorilla, stdhttp) so the runtime applies correct URL escaping per location - Add missing Type/Format fields to Echo v5 path, header, and cookie params, and upgrade its query binding to BindQueryParameterWithOptions - Fix required deepObject query params rejected by a spurious pre-check in Chi, Gin, Gorilla, Fiber, and stdhttp templates - Fix Gin, Iris, and Fiber using query param getters instead of path param getters for content-based (passthrough/JSON) path parameters - Fix Iris cookie params calling nonexistent ctx.Cookie() (now ctx.GetCookie()) and query params calling ctx.QueryParam() (now ctx.URLParam()) - Fix Fiber cookie params redeclaring var in a loop (now block-scoped) - Fix Fiber not URL-decoding path param values for passthrough/JSON - Add _ = err to suppress unused variable when only passthrough path params exist (Chi, Gin, Gorilla, Iris, Fiber, stdhttp) Multi-router parameter roundtrip test: - New test infrastructure under internal/test/parameters/ with per-router subdirectories (echo, chi, gin, gorilla, iris, fiber, stdhttp) plus a shared client package - Each router's server echoes received parameters back as JSON; the shared testImpl sends requests via the generated client and verifies the JSON response matches the original values - Generated files isolated in gen/ subdirectories so go generate works even when generated code has compilation errors - Echo v5 in its own module (Go 1.25+) with version-guarded Makefile - Covers all OpenAPI parameter styles (simple, label, matrix, form, deepObject) x types (primitive, array, object) x explode flags across path, query, header, and cookie locations Skipped tests pending external changes: - spaceDelimited and pipeDelimited query styles: runtime does not yet support binding these styles (oapi-codegen/runtime#116) - stdhttp roundtrip: stdlib ServeMux cannot register path wildcards starting with a digit like {1param} (oapi-codegen#2306) Closes: oapi-codegen#777, oapi-codegen#1752 Obsoletes: oapi-codegen#1751, oapi-codegen#2062 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mromaszewicz
added a commit
to mromaszewicz/oapi-codegen
that referenced
this pull request
Mar 27, 2026
Audit and fix parameter binding in all 8 server code generation templates (Echo v4, Echo v5, Chi, Gin, Gorilla, Iris, Fiber, stdhttp) to ensure consistent, correct handling of path, query, header, and cookie parameters across all OpenAPI styles and types. Template fixes: - Add missing ParamLocation to path params (Gin, Fiber, Gorilla) and cookie params (Chi, Gin, Fiber, Gorilla, stdhttp) so the runtime applies correct URL escaping per location - Add missing Type/Format fields to Echo v5 path, header, and cookie params, and upgrade its query binding to BindQueryParameterWithOptions - Fix required deepObject query params rejected by a spurious pre-check in Chi, Gin, Gorilla, Fiber, and stdhttp templates - Fix Gin, Iris, and Fiber using query param getters instead of path param getters for content-based (passthrough/JSON) path parameters - Fix Iris cookie params calling nonexistent ctx.Cookie() (now ctx.GetCookie()) and query params calling ctx.QueryParam() (now ctx.URLParam()) - Fix Fiber cookie params redeclaring var in a loop (now block-scoped) - Fix Fiber not URL-decoding path param values for passthrough/JSON - Add _ = err to suppress unused variable when only passthrough path params exist (Chi, Gin, Gorilla, Iris, Fiber, stdhttp) Multi-router parameter roundtrip test: - New test infrastructure under internal/test/parameters/ with per-router subdirectories (echo, chi, gin, gorilla, iris, fiber, stdhttp) plus a shared client package - Each router's server echoes received parameters back as JSON; the shared testImpl sends requests via the generated client and verifies the JSON response matches the original values - Generated files isolated in gen/ subdirectories so go generate works even when generated code has compilation errors - Echo v5 in its own module (Go 1.25+) with version-guarded Makefile - Covers all OpenAPI parameter styles (simple, label, matrix, form, deepObject) x types (primitive, array, object) x explode flags across path, query, header, and cookie locations Skipped tests pending external changes: - spaceDelimited and pipeDelimited query styles: runtime does not yet support binding these styles (oapi-codegen/runtime#116) - stdhttp roundtrip: stdlib ServeMux cannot register path wildcards starting with a digit like {1param} (oapi-codegen#2306) Closes: oapi-codegen#777, oapi-codegen#1752 Obsoletes: oapi-codegen#1751, oapi-codegen#2062 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes: #1752
❓I haven't found a better way to write tests other than copying parameter tests, but I haven't done that yet. Please let me know what else I can do, I'll be happy to help.