[Python] adds required tag, allows null values in models#3923
[Python] adds required tag, allows null values in models#3923wing328 merged 3 commits intoswagger-api:masterfrom
Conversation
|
@vishalsanfran thanks for the PR. Would you please run |
|
pr is updated |
| {{#hasValidation}} | ||
|
|
||
| {{#required}} | ||
| if not {{name}}: |
There was a problem hiding this comment.
I think it would be an issue if {{name}} is 0 (integer) or False (boolean)
What about using if {{name}} is None to check instead?
There was a problem hiding this comment.
yes, makes sense, i'll update
There was a problem hiding this comment.
This particular issue was blocking me, since I got the invalid value due to a 0.
There was a problem hiding this comment.
I can merge this PR as @vishalsanfran has fixed the issue related to 0 and False but I found other issues about validation for optional properties and doing "required" check only if there are other validation rules (#hasValidation = true). I'll file another PR with the fix to the issues I mentioned.
There was a problem hiding this comment.
@vishalsanfran @jdevera FYI. I've filed #3944 with the fix.
There was a problem hiding this comment.
#3944 merged into master. Please pull the latest master to give it a try.
|
updated |
* upstream/master: [aspnet] Fix .sln/.xproj guids [Python][Flask] fix python2 support in Flask (swagger-api#3952) Bugfix/3929 do not set multipart (swagger-api#3932) fix python required property check and validation for optional properties required tag is used in model, allows null values (swagger-api#3923) fix number format for dart model support number enum for swift [Objc] Added support for lower case discriminator (swagger-api#3927) [Android][Volley] add serializeModel support to Android (swagger-api#3933) add more info about test with latest master add back java okhttp petstore client fix pom duplicated id issue update pom to test java okhttp-gson parcelable models fix bug with parcelable [Java] Fix bug in generated code if parcelableModel and serializableModel are both true. [Java] Make generated models Parcelable for okhttp-gson if the -DparcelableModel=true option is provided. add http://onedata.org validate(s)_presence_of Migration should create pluralized table names Change controller filenames Issue#3829. Objective-C client code, discriminator generated in both base and child.
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)2.3.0branch for breaking (non-backward compatible) changes.Description of the PR
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
Issue: #3922