Skip to content

feat: Allow boolean field to null #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion graphene_mongo/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def convert_field_to_int(field, registry=None):

@convert_mongoengine_field.register(mongoengine.BooleanField)
def convert_field_to_boolean(field, registry=None):
return NonNull(Boolean, description=field.db_field)
return Boolean(description=field.db_field, required=not field.null)


@convert_mongoengine_field.register(mongoengine.DecimalField)
Expand Down
4 changes: 2 additions & 2 deletions graphene_mongo/tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def test_should_object_id_convert_id():
assert_conversion(mongoengine.ObjectIdField, graphene.ID)


def test_should_boolean_convert_non_null():
assert_conversion(mongoengine.BooleanField, graphene.NonNull)
def test_should_boolean_convert_boolean():
assert_conversion(mongoengine.BooleanField, graphene.Boolean)


def test_should_decimal_convert_float():
Expand Down