collectionFormat 'multi' is not properly handled in generated code
まだ誰も着手していません。
評価
調査の方向性
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 はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
swagger-api/swagger-codegen#11812 · リアクション 1 件 ·
-
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
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
microsoft/magentic-ui#588 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
alexgorbatchev/simple-ptt#3 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
CorrelAid/formtransform#44 ·