OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
With reference to the parameters of the generated handler function above:
1) The date_time_last_modified is passed as a parameter to the handler function. The flask documentation states that this is not supported and the header parameter should be accessed via the connexion.request.headers object.
2) The patient_info_dto obviously reflects the request body data. While date_time_last_modified is actually used in the generated code, patient_info_dto is ignored completely and overwritten by the correct way to access the body data.
Request error out with:
TypeError: api_v1_patientinfo_id_put() missing 2 required positional arguments: 'dateTimeLastModified' and 'patient_info_dto'
I guess the expected behaviour is to generate the handler function without header parameters and request body parameter and change the default code to accessing the header parameters directly from the connexion.request.headers object.
openapi-generator version
openapi-generator-cli: 5.1.0
commit: e023eaa
built: 2021-03-20T09:44:04Z
OpenAPI declaration file content or url
put:
tags:
- Patient Information
summary: "..."
description: "..."
parameters:
- name: id
in: path
description: The patient info identifier.
required: true
schema:
type: string
- name: dateTimeLastModified
in: header
description: The date and time when the patient information was last modified.
required: true
schema:
type: string
format: date-time
requestBody:
description: The patient information to update.
content:
application/json:
schema:
$ref: "#/components/schemas/PatientInfoDto"
required: true
responses:
"200":
description: successful update of the patient information.
content:
application/json:
schema:
$ref: "#/components/schemas/PatientInfoMetadataDto"
"400":
description: operation failed due to missing or invalid input parameters.
"401":
description: client cannot be authenticated.
"403":
description: client is not allowed to execute the operation.
content:
application/json:
schema:
$ref: "#/components/schemas/StatusMessageDto"
"404":
description: patient information identifier not found.
"409":
description: operation cannot be processed, patient information is outdated.
Bug Report Checklist
Description
The OpenAPI spec bellow contains a header parameter (
in:header
) nameddateTimeLastModified
.According to the docs, header parameters should be supported by the generator.
The generated controller looks like this:
With reference to the parameters of the generated handler function above:
1) The
date_time_last_modified
is passed as a parameter to the handler function. The flask documentation states that this is not supported and the header parameter should be accessed via theconnexion.request.headers
object. 2) Thepatient_info_dto
obviously reflects the request body data. Whiledate_time_last_modified
is actually used in the generated code,patient_info_dto
is ignored completely and overwritten by the correct way to access the body data.Request error out with:
TypeError: api_v1_patientinfo_id_put() missing 2 required positional arguments: 'dateTimeLastModified' and 'patient_info_dto'
I guess the expected behaviour is to generate the handler function without header parameters and request body parameter and change the default code to accessing the header parameters directly from the
connexion.request.headers
object.openapi-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce