Skip to content

Set converted Django connections to required #610

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
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
6 changes: 4 additions & 2 deletions graphene_django/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,11 @@ def dynamic_type():
if _type._meta.filter_fields or _type._meta.filterset_class:
from .filter.fields import DjangoFilterConnectionField

return DjangoFilterConnectionField(_type, description=description)
return DjangoFilterConnectionField(
_type, required=True, description=description
)

return DjangoConnectionField(_type, description=description)
return DjangoConnectionField(_type, required=True, description=description)

return DjangoListField(
_type,
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/filter/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def get_resolver(self, parent_resolver):
return partial(
self.connection_resolver,
parent_resolver,
self.type,
self.connection_type,
self.get_manager(),
self.max_limit,
self.enforce_first_or_last,
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class Meta:
assert isinstance(graphene_field, graphene.Dynamic)
dynamic_field = graphene_field.get_type()
assert isinstance(dynamic_field, ConnectionField)
assert dynamic_field.type == A._meta.connection
assert dynamic_field.type.of_type == A._meta.connection


def test_should_manytoone_convert_connectionorlist():
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def test_schema_representation():
pets: [Reporter!]!
aChoice: ReporterAChoice
reporterType: ReporterReporterType
articles(before: String, after: String, first: Int, last: Int): ArticleConnection
articles(before: String, after: String, first: Int, last: Int): ArticleConnection!
}

enum ReporterAChoice {
Expand Down