-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Description
Description
I generated a data structure that has a nullable property, yet the python code that is generated does not see it.
Swagger-codegen version
https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.16/swagger-codegen-cli-2.4.16.jar
Swagger declaration file content or url
"ProjectProfile": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"result": {
"type": "object",
"description": "An object from the JSON field in the database",
"nullable": true,
"default": {}
}
},
"required": ["id", "result"]
},Command line used for generation
java -jar swagger-codegen-cli.jar generate -i http://localhost:3001/api-docs-json -l python -o swapp_system_client_package -DpackageName=swapp_system_client
Steps to reproduce
run codegen with json snippet, this is how the python will look for result setter:
@result.setter
def result(self, result):
"""Sets the result of this ProjectProfile.
An object from the JSON field in the database # noqa: E501
:param result: The result of this ProjectProfile. # noqa: E501
:type: object
"""
if result is None:
raise ValueError("Invalid value for `result`, must not be `None`") # noqa: E501
self._result = resultRelated issues/PRs
Suggest a fix/enhancement
It seems like nullable flag does not affect the setter code generation in python.
dRacz3, rvinzent, mcejp, MalteEbner and aarighi
Metadata
Metadata
Assignees
Labels
No labels