fix: properly handle quotes in content-type when generating server code#1929
Merged
mromaszewicz merged 7 commits intoMay 4, 2026
Merged
Conversation
viktorasm
marked this pull request as draft
March 15, 2025 14:45
viktorasm
marked this pull request as ready for review
March 15, 2025 14:54
|
I gave this a quick try. It's now able to generate code for my original API definition, so this looks good to me. |
Member
|
I'm going to rebase and fix up this commit then merge it. It does address a few bugs, thanks. |
# Conflicts: # pkg/codegen/template_helpers.go # pkg/codegen/templates/strict/strict-fiber-interface.tmpl # pkg/codegen/templates/strict/strict-interface.tmpl # pkg/codegen/templates/strict/strict-iris-interface.tmpl
mromaszewicz
approved these changes
May 4, 2026
lwc
pushed a commit
to lwc/oapi-codegen
that referenced
this pull request
Jun 23, 2026
…de (oapi-codegen#1929) fixes oapi-codegen#1799 OpenAPI media types may contain characters that require escaping in Go string literals, for example, application/ld+json; profile="https://..." which the templates were emitting verbatim, producing invalid Go. PR oapi-codegen#2217 had a partial fix for this, and this PR fixes the other cases. Adds a regression test under internal/test/issues/issue1799/ covering chi, client, echo, fiber, gin, gorilla, iris, and std-http generation modes with a spec containing a quoted media-type parameter. Co-authored-by: Marcin Romaszewicz <marcinr@gmail.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 #1799
OpenAPI media types may contain characters that require escaping in Go string literals, for example,
application/ld+json; profile="https://..."which the templates were emitting verbatim, producing invalid Go.PR #2217 had a partial fix for this, and this PR fixes the other cases.
Adds a regression test under
internal/test/issues/issue1799/covering chi, client, echo, fiber, gin, gorilla, iris, and std-http generation modes with a spec containing a quoted media-type parameter.