From 70b5d6c5b8f09c6fd542955e16198564425e68e9 Mon Sep 17 00:00:00 2001 From: Stella Margonar Date: Tue, 28 Jan 2020 15:20:17 +0100 Subject: [PATCH] handle default=false for boolean fields --- rest_framework/schemas/openapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/schemas/openapi.py b/rest_framework/schemas/openapi.py index 351174aac..6f3e854b0 100644 --- a/rest_framework/schemas/openapi.py +++ b/rest_framework/schemas/openapi.py @@ -378,7 +378,7 @@ class AutoSchema(ViewInspector): schema['writeOnly'] = True if field.allow_null: schema['nullable'] = True - if field.default and field.default != empty and not callable(field.default): + if field.default is not None and field.default != empty and not callable(field.default): schema['default'] = field.default if field.help_text: schema['description'] = str(field.help_text)