Bug Report Checklist
Description
When using this spec as input:
openapi: "3.0.0"
info:
title: "My API"
version: "0.0.1"
paths:
/invoices:
get:
parameters:
- name: filter
in: query
description: Filter parameters
required: false
schema:
type: object
properties:
field:
type: string
responses:
'200':
description: An array of invoices
content:
application/json:
schema:
type: array
items:
type: object
properties:
number:
type: integer
format: int64
a default_controller.py is generated containing the following code:
import connexion
import six
from openapi_server.models.filter import Filter # noqa: E501
from openapi_server.models.inline_response200 import InlineResponse200 # noqa: E501
from openapi_server import util
def invoices_get(filter=None): # noqa: E501
"""invoices_get
# noqa: E501
:param filter: Filter parameters
:type filter: dict | bytes
:rtype: List[InlineResponse200]
"""
if connexion.request.is_json:
filter = .from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!'
The .from_dict is invalid Python syntax.
Trying to run the generated application, results in the following error:
jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'components/parameters/filter'
openapi-generator version
4.2.2
OpenAPI declaration file content or url
See above.
Command line used for generation
openapi-generator generate -i ./openapi.yaml -g python-flask -o ./generated
Steps to reproduce
- Use above command and openapi.yaml to generate python-flask code.
Related issues/PRs
Suggest a fix
I suppose the .from_dict needs to be prefixed by a class name.
Bug Report Checklist
4.2.2
I would've expected this to generate code that compiles/runs. But the
.from_dictseems invalid Python syntax.Description
When using this spec as input:
a default_controller.py is generated containing the following code:
The
.from_dictis invalid Python syntax.Trying to run the generated application, results in the following error:
jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'components/parameters/filter'openapi-generator version
4.2.2
OpenAPI declaration file content or url
See above.
Command line used for generation
openapi-generator generate -i ./openapi.yaml -g python-flask -o ./generated
Steps to reproduce
Related issues/PRs
Suggest a fix
I suppose the .from_dict needs to be prefixed by a class name.