swagger-api / swagger-api/swagger-codegen
[PYTHON] Handling multiple responses with codegen
オープン
まだ誰も着手していません。
- 主要言語
- Mustache
- スター
- 17.8k
- フォーク
- 6k
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I have different type of responses for different status code , consider the contents of swagger.json to be
{
"swagger": "2.0",
"info": {
"title": "My Api",
"description": "Api for Queue",
"version": "v1"
},
"host": "localhost:8000",
"schemes": ["http"],
"basePath": "/api",
"consumes": ["application/json"],
"produces": ["application/json"],
"securityDefinitions": {},
"security": [{}],
"paths": {
"/v1/{name}/get_task": {
"get": {
"operationId": "v1_get_task_read",
"description": "Get the first task from queue \n---",
"parameters": [{
"name": "priority",
"in": "query",
"required": false,
"type": "string"
}],
"responses": {
"200": {
"description": "QueuedTask Object",
"schema": {
"$ref": "#/definitions/QueuedTask"
}
},
"204": {
"description": "null object response"
}
},
"tags": ["v1"]
},
"parameters": [{
"name": "name",
"in": "path",
"required": true,
"type": "string"
}]
}
},
"definitions": {
"QueuedTask": {
"required": ["name"],
"type": "object",
"properties": {
"id": {
"title": "ID",
"type": "integer",
"readOnly": true
},
"name": {
"title": "Name",
"type": "string",
"maxLength": 16
}
}
}
}
}
Swagger codegen version 2.3.1
java -jar swagger-codegen-cli-2.3.1.jar generate -l python -i swagger.json -o outs
swagger_client produced inside outs directory doesn't support None object for 204 response. It tries to deserialize the empty response into QueuedTask object and breaks.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された swagger.json を使用し、指定された Swagger Codegen 2.3.1 の Python 生成コマンドを実行してください。生成された swagger_client における 200 および 204 レスポンスの処理を調査し、空の 204 レスポンスに重点を置いてください。生成されたクライアントが 204 レスポンスを QueuedTask としてデシリアライズしようとせずに受け入れ、同時に 200 レスポンスの動作を維持できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100