Gaiia.Schema (Gaiia v0.2.0)

Copy Markdown View Source

Compile-time access to the Gaiia GraphQL schema.

At compile time this module loads the operation specs from priv/queries.json and priv/mutations.json (extracted from the full introspection schema) so generator modules can iterate over every operation.

Summary

Functions

Normalize a schema description for use in @doc.

Build the @doc body for a generated operation function.

Convert a camelCase GraphQL name to an Elixir-friendly snake_case atom.

Return the list of all mutation operation specs.

Return the list of all query operation specs.

Functions

description(text)

@spec description(String.t()) :: String.t()

Normalize a schema description for use in @doc.

Descriptions are written for Gaiia's own documentation site and contain site-relative markdown links such as [Files](../../files). Those targets do not exist here, so ExDoc resolves them as broken file references. Links with a relative target collapse to their label as inline code; absolute links are left intact.

doc(op, op_type)

@spec doc(map(), :query | :mutation) :: String.t()

Build the @doc body for a generated operation function.

Carries the schema's own description, the GraphQL operation it wraps, and a table of every argument with its rendered GraphQL type and default.

function_name(camel_name)

@spec function_name(String.t()) :: atom()

Convert a camelCase GraphQL name to an Elixir-friendly snake_case atom.

mutations()

Return the list of all mutation operation specs.

queries()

Return the list of all query operation specs.