Skip to content

fix: support x-oapi-codegen-extra-tags on path params in strict-server RequestObject#2262

Merged
mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
mromaszewicz:fix/issue-2261
Apr 29, 2026
Merged

fix: support x-oapi-codegen-extra-tags on path params in strict-server RequestObject#2262
mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
mromaszewicz:fix/issue-2261

Conversation

@mromaszewicz

Copy link
Copy Markdown
Member

No description provided.

@mromaszewicz mromaszewicz requested a review from a team as a code owner February 28, 2026 15:50
@mromaszewicz mromaszewicz added the bug Something isn't working label Feb 28, 2026
@mromaszewicz mromaszewicz added this to the v2.7.0 milestone Apr 21, 2026
…r RequestObject

ParameterDefinition.JsonTag() only produced a `json:"..."` tag and
ignored x-oapi-codegen-extra-tags. This meant path parameters in
strict-server RequestObject structs never included extra struct tags,
even though query/header/cookie parameters did (via GenerateParamsTypes).

Update JsonTag() to read x-oapi-codegen-extra-tags from both the
parameter and schema levels, with parameter-level taking precedence,
matching the existing merge behavior in GenerateParamsTypes().

Fixes oapi-codegen#2261

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mromaszewicz

Copy link
Copy Markdown
Member Author

@greptileai

@greptile-apps

greptile-apps Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR extends ParameterDefinition.JsonTag() in operations.go to support x-oapi-codegen-extra-tags at both the schema level and the parameter level (parameter-level takes precedence), mirroring the existing behaviour in schema.go for struct-field tags. Unit tests are added in operations_test.go covering required/optional params, both tag sources, and precedence.

Confidence Score: 4/5

Safe to merge; the only finding is a minor documentation/guard concern consistent with existing codebase patterns.

Only P2 findings present. The implementation is correct, nil-safe, and consistent with the existing schema.go handling of the same extension.

No files require special attention.

Important Files Changed

Filename Overview
pkg/codegen/operations.go Extends JsonTag() to merge x-oapi-codegen-extra-tags from schema and parameter levels; logic mirrors the existing schema.go implementation and is otherwise correct.
pkg/codegen/operations_test.go Adds thorough unit tests for the new JsonTag() behaviour, covering required/optional, schema-level, parameter-level, and precedence cases.

Reviews (1): Last reviewed commit: "fix: support x-oapi-codegen-extra-tags o..." | Re-trigger Greptile

@mromaszewicz mromaszewicz merged commit a10a2a2 into oapi-codegen:main Apr 29, 2026
18 checks passed
@mromaszewicz mromaszewicz deleted the fix/issue-2261 branch April 29, 2026 15:54
@mromaszewicz mromaszewicz changed the title Fix/issue 2261 fix: support x-oapi-codegen-extra-tags on path params in strict-server RequestObject May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x-oapi-codegen-extra-tags on path parameters not generated in strict-server RequestObject structs

1 participant