-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Milestone
Description
Description
Hello, we've been testing the swagger-codegen from editor.swagger.io for Python Client and we noticed that a POST-Redirect-GET generates the Client Stub with response_type=None instead of the correct type.
I don't know if this is by design or if it's a bug
Swagger-codegen version
2.2.0
Swagger declaration file content or url
---
swagger: "2.0"
info:
description: "Foo"
version: "v1"
title: "Bar"
termsOfService: "http://terms"
host: "localhost:8080"
basePath: "/api"
tags:
- name: "foo"
description: "bar"
schemes:
- "http"
- "https"
paths:
/foo:
post:
tags:
- "foo"
summary: "Creates a new Foo Object"
description: ""
operationId: "createFoo"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "Foo"
description: "Foo Data for creation"
required: true
schema:
$ref: "#/definitions/FooBarData"
responses:
303:
description: "Redirects to created Foo URL"
404:
description: "Invalid data"
/foo/{id}:
get:
tags:
- "foo"
summary: "Gets a Foo entry by Id"
description: ""
operationId: "getFooById"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "id"
in: "path"
description: "id"
required: true
type: "string"
format: "uuid"
responses:
200:
description: "The Foo"
schema:
$ref: "#/definitions/FooResult"
400:
description: "Invalid UUID format"
404:
description: "Foo not found"
definitions:
FooBarData:
type: "object"
properties:
name:
type: "string"
minLength: 1
maxLength: 256
description:
type: "string"
FooResult:
type: "object"
properties:
id:
type: "string"
format: "uuid"
name:
type: "string"
description:
type: "string"
Command line used for generation
swagger-codegen generate -i swagger.yaml -l python -o /tmp/test
Steps to reproduce
Just call FooApi.create_foo() with FooData() and you'll notice that on the self.api_client.call_api within the create_foo_with_http_info
method the response_type=None
Related issues
Suggest a Fix
If it's redirected to another known Endpoint, it should Infer the returned Types/Deserialized Objects