collectionFormat 'multi' is not properly handled in generated code
还没有人认领这个 Issue。
评估
调研方向
从 modules/swagger-codegen/src/main/resources/go/client.mustache 中引用的参数处理函数开始,然后对比 modules/swagger-codegen/src/main/resources/python/api_client.mustache 中对 multi collectionFormat 的处理。使用 swag init 根据示例声明生成 Go 客户端,并验证包含多个值的 ids 查询是使用分隔符发送的,而不是拼接后发送的。
由索引模型根据 Issue 内容生成。
描述
Description
Query array declared with collectionFormat(multi) is not generated correctly, with ids concatenated without separator.
Swagger-codegen version
main branch
Swagger declaration file content or url
{
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi",
"description": "ids to query for objects",
"name": "ids",
"in": "query"
},
Command line used for generation
swag init
Steps to reproduce
- Make a REST API endpoint which takes a list of ids and declare it with
collectionFormat(multi)
e.g.// @Param ids query []string false "ids to query for objects" collectionFormat(multi) - Generate API client with
swagger-codegenforgolang - Send a request to API with generated API client code and find on server side that ids are concatenated without separators
Related issues/PRs
Not related, but probably in similar area.
https://github.com/swagger-api/swagger-codegen/issues/10963
Suggest a fix/enhancement
Add handling for collectionFormat multi to the following function:
https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/go/client.mustache#L129
Similar to python
https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/python/api_client.mustache#L423
- 主要语言
- Mustache
- 星标
- 17.8k
- 派生
- 6k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
swagger-api/swagger-codegen 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
swagger-api/swagger-codegen#12755 ·
-
security vulnerability
难度 1/5 1 小时以内 新手友好度 62/100
swagger-api/swagger-codegen#11942 ·
-
[JAVA] Non compilable enums generated with property errorOnUnknownEnum=true可能已有人在做 @HiagoW 于 1463 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
swagger-api/swagger-codegen#11812 · 1 个 reaction ·
-
security vulnerability
难度 2/5 1-3 小时 新手友好度 65/100
swagger-api/swagger-codegen#11594 ·
-
难度 1/5 1 小时以内 新手友好度 62/100
swagger-api/swagger-codegen#10969 ·
查看 swagger-api/swagger-codegen 的全部 Issue
相似的 Issue
-
[Bug] dubbo.protocol.triple.max-message-size is only read from OS environment variables可能已有人在做 @CCCLL 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
domain/discovery
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
nonews refactor
难度 2/5 1-3 小时 新手友好度 75/100
Uninett/nav#4255 · 1 条评论 · 1 个 reaction ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
hierynomus/sshj#1070 ·