-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Python] Generated code does not respect nullable values #8710
Comments
It is no fixed. When property with enum and nullable:true None doesn`t add in allowed_values. |
I have the same issue using v2.4.8 |
I'm facing the same problem apparently. is this solved? |
+1 any update on if there is going to be a code change so that the None check is added only if nullable is not True? |
hey guys, sorry for delay on. this issue. According to links pointing to code in templates, the check it's only added when the property is required. So, it does not make sense to have a nullable required property. What do you guys think? https://stackoverflow.com/questions/45575493/what-does-required-in-openapi-really-mean |
@HugoMario Also, this issue seems to describe the same problem: #10535 (I have also experienced this issue with some project, and will not use the swagger codegen to generate my python client due to this problem). I have used the docker images for testing it. Checked back till a version 3.0.15, does not seem to work with any version :( |
Hi, still have the same problem. Is there any progress? |
Description
There is always generated following code which prevents from
None
(null) values:Unfortunately this check is generated even if the swagger definition explicitly says the given model attribute is nullable (by providing
nullable: true
).Swagger-codegen version
The latest master to this date - master SHA 554d443.
Swagger declaration file content or url
Command line used for generation
java -jar swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i "${SWAGGER_YAML}" -l python
Steps to reproduce
Use any swagger definition and set
nullable
to true to any model attribute.Related issues/PRs
None found.
Suggest a fix/enhancement
swagger-codegen/modules/swagger-codegen/src/main/resources/python/model.mustache
Lines 100 to 103 in 554d443
swagger-codegen/modules/swagger-codegen/src/main/resources/flaskConnexion/model.mustache
Lines 119 to 122 in 554d443
The text was updated successfully, but these errors were encountered: