Set x-nullable based on allow_null (#217)

Many fields may be set a nullable in an API. While not covered explicitly by Swagger 2, this information is usually indicated as a [vendor extension](https://swagger.io/docs/specification/2-0/swagger-extensions/) using the x-nullable field.
This commit is contained in:
Rémi Lapeyre authored and Cristi Vîjdea committed 2018-10-10 01:24:42 +03:00
1 parent c510de13d7
commit d41f0c5ac4
3 files changed
+17 -2

No files matched your search

+6 -1
View File
@@ -33,7 +33,12 @@ class ArticleSerializer(serializers.ModelSerializer):
class ImageUploadSerializer(serializers.Serializer):
what_am_i_doing = serializers.RegexField(regex=r"^69$", help_text="test", default="69")
what_am_i_doing = serializers.RegexField(
regex=r"^69$",
help_text="test",
default="69",
allow_null=True
)
image_styles = serializers.ListSerializer(
child=serializers.ChoiceField(choices=['wide', 'tall', 'thumb', 'social']),
help_text="Parameter with Items"