fix(goctl/swagger): ignore '-' tags in parameters and properties#5544
fix(goctl/swagger): ignore '-' tags in parameters and properties#5544TanishValesha wants to merge 1 commit into
Conversation
Swagger generation should treat struct tags like form:"-" and json:"-" as ignored fields. This prevents emitting parameters/properties named "-" and avoids duplicate (in,name) entries. Made-with: Cursor
ReviewGood fix for a swagger generation correctness issue (fixes #5427). Problem: Fields with Changes:
Suggestions:
Code quality: Straightforward conditional checks matching Go's encoding/json convention. The tests cover the primary scenarios. LGTM — clean fix for a well-defined spec violation. |
|
@kevwan Thanks for the review and sorry for this late reply! |
|
@kevwan lmk, if there is any problem with merging this PR ? |
Fixes #5427
Summary
"-"tag names as ignored fields instead of emitting parameters/properties named"-".(in=query, name="-")caused by multipleform:"-"fields.form:"-"in parameters andjson:"-"in schema properties.What changed
tools/goctl/api/swagger/parameter.goheader,path,form, andjsontags when tag name is"-".tools/goctl/api/swagger/properties.gojson:"-".TestParametersFromType_IgnoreDashTagNameintools/goctl/api/swagger/parameter_test.goTestPropertiesFromType_IgnoresJsonDashTagintools/goctl/api/swagger/swagger_test.go