Closed joshuaboniface closed 1 month ago
I have an OpenAPI 2.0 specification generated with Flask-Swagger, i.e. it has swagger: "2.0".
swagger: "2.0"
Trying to run fastapi-code-generator on this, I get errors like this for all of my parameters:
│ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ │ data_type = None │ │ │ │ name = 'sort_key' │ │ │ │ orig_name = 'sort_key' │ │ │ │ parameters = ParameterObject(name='sort_key', in_=<ParameterLocation.query: 'query'>, description='The fault object key to sort results by', required=False, deprecated=False, schema_=None, example=None, examples=None, content={}) │ │ │ │ path = ['#/paths', 'api/v1/faults', 'get', 'parameters'] │ │ │ │ schema = None │ │ │ │ self = <fastapi_code_generator.parser.OpenAPIParser object at 0x7fb59febc8d0> │ │ │ │ snake_case = False │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ ╰────────────────────────────── RuntimeError: schema is None
Which is expected: OpenAPI 2.0 does not have the concept of a schema for parameters, only a type directly.
schema
type
Is this supported somehow?
I ended up rebuilding my API specification as OpenAPI 3.0 and this worked, so I suspect this just isn't supported. Closing out to avoid clutter, but I would suggest adding this to the docs.
I have an OpenAPI 2.0 specification generated with Flask-Swagger, i.e. it has
swagger: "2.0"
.Trying to run fastapi-code-generator on this, I get errors like this for all of my parameters:
Which is expected: OpenAPI 2.0 does not have the concept of a
schema
for parameters, only atype
directly.Is this supported somehow?