Skip to content

angee.graphql.ids

GraphQL public-id primitives for Angee schemas.

PublicID

GraphQL ID scalar carrying an Angee public id, usually a model sqid.

public_id_value

python
def public_id_value(value: Any) -> str

Return value as the raw public id used at GraphQL boundaries.

to_public_id

python
def to_public_id(model: type[models.Model], fk_id: Any) -> PublicID | None

Project a model foreign-key value to its public id, or None when unset.

require_public_id

python
def require_public_id(model: type[models.Model], fk_id: Any) -> PublicID

Project a required (non-null) model foreign-key value to its public id.

optional_public_id

python
def optional_public_id(value: str | None) -> PublicID | None

Wrap an optional already-resolved public id string as a GraphQL ID.

instance_for_id

python
def instance_for_id(
        model: type[_ModelT],
        value: Any,
        *,
        queryset: models.QuerySet[_ModelT] | None = None) -> _ModelT | None

Return model row addressed by a GraphQL public id.

require_instance_for_id

python
def require_instance_for_id(
        model: type[_ModelT],
        value: Any,
        *,
        queryset: models.QuerySet[_ModelT] | None = None) -> _ModelT

Return the row for value or raise a stable not-found error.

assert_unique_sqid_prefixes

python
def assert_unique_sqid_prefixes(types: tuple[object, ...]) -> None

Fail schema build when two public model owners declare the same sqid prefix.

Released under the AGPL-3.0 License.