Open jethrogillgren opened 3 years ago
~Smaller~ different example:
openapi: '3.0.0'
tags:
- name: baz
description: Working Junk
- name: bar
description: Broken Junk
info:
title: Test
description: Test
version: 0.0.1
paths:
/foo/bar/{id}:
delete:
operationId: deleteBar
summary: Delete bar
tags:
- bar
parameters:
- in: path
name: id # does not work
schema:
$ref: '#/components/schemas/id'
required: true
description: id of junk to delete
responses:
200:
description: "Deleted"
404:
description: "Not found"
/foo/baz/{id}:
delete:
operationId: deleteBaz
summary: Delete baz
tags:
- baz
parameters:
- in: path
name: id
schema: # "works"
type: string
required: true
description: id of junk to delete
responses:
200:
description: "Deleted"
404:
description: "Not found"
components:
schemas:
id:
type: string
description: id of junk
example: 12345
**bar_controller.py
import connexion
import six
from swagger_server.models.id import Id # noqa: E501
from swagger_server import util
def delete_bar(id): # noqa: E501
"""Delete bar
# noqa: E501
:param id: id of junk to delete
:type id: dict | bytes
:rtype: None
"""
if connexion.request.is_json:
id = .from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!'
baz_controller.py
import connexion
import six
from swagger_server import util
def delete_baz(id): # noqa: E501
"""Delete baz
# noqa: E501
:param id: id of junk to delete
:type id: str
:rtype: None
"""
return 'do some magic!'
the bar_controller
has the problem.
DELETE can't have a requestBody so the junk line doesn't make sense.
just a wild guess, but in my code there was a schema, but it was still a 'primitive type' of a string.
that, or the baseType didn't get set somehow
actually, why isn't baseType
set to Id
in my example above?
^ I'm on swagger-codegen 3.0.24
I couldn't get my file to even load on the HEAD version (#10157).
Workaround: I found that openapi-generator@5.0.1 works fine, so I've switched to that.
Description
The python-flask generated server doesn't run due syntax errors:
Swagger-codegen version
3.0.22
Swagger declaration file content or url
Tested against the PetStore V 3.0 with an
anyOf
element, eg https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml withOr the below complete example:
Command line used for generation
Steps to reproduce
generate using above command. Edit the requirements.txt to workaround existing bug https://github.com/swagger-api/swagger-codegen-generators/issues/780 docker build -t testcase . docker run testcase
Thanks for any assistance, we'd love to use the project.