graphql-python / graphql-python/graphene-sqlalchemy

required should be inferred from the return type of a hybrid property

Open
#427 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
985
Forks
223
PR merge metrics
No merged PRs in 30d

Description

With a definition like:
```
@hybrid_property
def is_active(self) -> bool:
return self.state == 'ACTIVE'
```

The resulting graphql field type is currently marked `Boolean` unless overridden by `ORMField()`. Column properties correctly determine the nullability from the column definition. It seems reasonable to do the same for the hybrid_property based on the declared type. If the return type were `bool | None`, then it would be optional, otherwise it should be required.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.