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
2018-10-10 00:24:42 +02:00
committed by Cristi Vîjdea
parent c510de13d7
commit d41f0c5ac4
3 changed files with 17 additions and 2 deletions
+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"