Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

Fix ParamsTypeName template context bug and normalize variable access#5

Merged
mromaszewicz merged 1 commit intomainfrom
fix/issue-1-params-type-name-template
Feb 8, 2026
Merged

Fix ParamsTypeName template context bug and normalize variable access#5
mromaszewicz merged 1 commit intomainfrom
fix/issue-1-params-type-name-template

Conversation

@mromaszewicz
Copy link
Copy Markdown
Member

Save ParamsTypeName as a local variable before entering nested range .Bodies loops in client and initiator interface templates, matching the pattern used by all other templates. Without this, $.ParamsTypeName fails because $ refers to the root context (a slice or struct) which has no such field, causing a template error when generating client code for operations with both params and a body.

Also normalize all initiator templates to consistently save $.Prefix and $.PrefixLower as $prefix/$prefixLower at the top of the range .Operations loop and use the saved variables throughout, instead of mixing direct root context access ($.Prefix) with saved variables.

Fixes #1

Save ParamsTypeName as a local variable before entering nested
range .Bodies loops in client and initiator interface templates,
matching the pattern used by all other templates. Without this,
$.ParamsTypeName fails because $ refers to the root context (a slice
or struct) which has no such field, causing a template error when
generating client code for operations with both params and a body.

Also normalize all initiator templates to consistently save $.Prefix
and $.PrefixLower as $prefix/$prefixLower at the top of the
range .Operations loop and use the saved variables throughout, instead
of mixing direct root context access ($.Prefix) with saved variables.

Fixes #1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mromaszewicz mromaszewicz merged commit 8d75d5c into main Feb 8, 2026
4 checks passed
@mromaszewicz mromaszewicz deleted the fix/issue-1-params-type-name-template branch February 8, 2026 04:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAPI 3.1 client generation ParamsTypeName error

1 participant