Skip to content

angee.graphql.introspection

Strawberry and strawberry-django introspection helpers.

surface_name

python
def surface_name(surface: object) -> str

Return a readable name for a Strawberry surface.

surface_field_names

python
def surface_field_names(surface: object) -> tuple[str, ...]

Return field names declared by a Strawberry type.

django_model

python
def django_model(node: type) -> type[models.Model]

Return the Django model backing a strawberry-django type.

is_to_one_relation

python
def is_to_one_relation(field: models.Field[Any, Any]) -> bool

Return whether field is a forward to-one relation.

is_to_many_relation

python
def is_to_many_relation(field: models.Field[Any, Any]) -> bool

Return whether field represents a to-many relation path.

FieldPathError

python
class FieldPathError(Exception)

A __/.-separated relation path could not resolve to a leaf to-one field.

Carries the failure mode so callers translate it to their own wording: to_many marks a rejected to-many segment, unknown covers a missing field or a path that walks past a non-relation leaf.

require_field_for_path

python
def require_field_for_path(model: type[models.Model],
                           path: str) -> models.Field[Any, Any]

Resolve a __/.-separated relation path to a leaf to-one field.

Walks each segment with _meta.get_field, following the forward relation at each step, and raises :class:FieldPathError (to_many or unknown) so each caller renders its own diagnostic message.

Released under the AGPL-3.0 License.