Repository navigation
fix: rename path parameters that collide with generated names - #88
Merged
Merged
Conversation
A path parameter whose Go name is one the generated method or handler uses
itself, such as go-api-libs/ibkr's u, the request URL, no longer breaks the
build: it is suffixed with Param, as are keywords and predeclared names, in
the signature, the path, the server handler and api.js alike.
The golden spec gains /portfolio/{u}/summary/{req}. The server's panic on a
parameter inside a segment, which ibkr's path also has, goes on the roadmap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Pd6RdtkAJq4fCsH7CzhRx
# Conflicts: # docs/roadmap.md
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.
go-api-libs/ibkr failed to build: the path parameter
uof/portfolio/U{u}/summarybecame the argumentu string, and the method then assigned the request URL tou.ir/operation.go:pathParamNamegives a path parameter its Go identifier. It adds the suffixParamwhen the name is a Go keyword, a predeclared identifier, or a name the generated code uses where the parameter is in scope: the client method's locals (u,q,req,rsp,ia,err,pr,pw,body,out, …), the receiverc,ctx, the server handler's locals, and the packages they use.GoNameandVarNameboth come from it, so the signature, the JoinPath arguments, the server'sService/handler andapi.jsall agree.GET /portfolio/{u}/summary/{req}. Its generated code was produced in a scratch directory and the diff applied by hand. The diff only adds code for the new operation. A hand-writtenTestPath_RenamesParameterschecks that the client calls/v1/portfolio/U1234/summary/r1.U{u},CIK{cik}.json) becausehttp.ServeMuxdoes not accept that wildcard. That is why the golden case uses whole segments.make readypasses.make all(govulncheck) was not run.Generated by Claude Code