-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Description
Description
There is always generated following code which prevents from None (null) values:
if requirements_lock is None:
raise ValueError("Invalid value for `<attr_name>`, must not be `None`") # noqa: E501Unfortunately 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 pythonSteps 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
| {{#required}} | |
| if {{name}} is None: | |
| raise ValueError("Invalid value for `{{name}}`, must not be `None`") # noqa: E501 | |
| {{/required}} |
swagger-codegen/modules/swagger-codegen/src/main/resources/flaskConnexion/model.mustache
Lines 119 to 122 in 554d443
| {{#required}} | |
| if {{name}} is None: | |
| raise ValueError("Invalid value for `{{name}}`, must not be `None`") # noqa: E501 | |
| {{/required}} |
aarighi and bgshacklett
Metadata
Metadata
Assignees
Labels
No labels