Description
Swagger ignores 'required' tag in model.mustache in python.
The setter function for these properties does not allow null values, unlike ruby and other languages
Swagger-codegen version
2.2.1 (latest)
Steps to reproduce
- Required is false
"license":
{"type":"string","description":"license key", required: false}
Expected output:
@license.setter
def license(self, license):
self._license = license
- Required is true
"license":
{"type":"string","description":"license key", required: true}
Expected output:
@license.setter
def license(self, license):
if not license:
raise ValueError("Invalid value for license, must not be None")
self._license = license
Currently, output is always 2) whether 'required' is true or false
Suggest a Fix
Its a simple 2 line fix, very similar to the ruby code
i'll submit it
Description
Swagger ignores 'required' tag in model.mustache in python.
The setter function for these properties does not allow null values, unlike ruby and other languages
Swagger-codegen version
2.2.1 (latest)
Steps to reproduce
"license":
{"type":"string","description":"license key", required: false}
Expected output:
@license.setter
def license(self, license):
self._license = license
"license":
{"type":"string","description":"license key", required: true}
Expected output:
@license.setter
def license(self, license):
if not license:
raise ValueError("Invalid value for license, must not be
None")self._license = license
Currently, output is always 2) whether 'required' is true or false
Suggest a Fix
Its a simple 2 line fix, very similar to the ruby code
i'll submit it