TypedGql.Schema (TypedGql v0.13.0)

Copy Markdown View Source

A GraphQL schema loaded from an introspection result.

This is what the server says it offers — the root operation types, every named type and every directive — and what queries are validated and generated against.

Summary

Types

t()

@type t() :: %TypedGql.Schema{
  directives: [TypedGql.Schema.Directive.t()],
  mutation_type: String.t() | nil,
  query_type: String.t() | nil,
  subscription_type: String.t() | nil,
  types: %{required(String.t()) => TypedGql.Schema.Type.t()}
}

Functions

abstract?(schema, type_name)

@spec abstract?(t(), String.t()) :: boolean()

Whether type_name names an abstract type — a union or an interface.

A name the schema does not define is not abstract; the callers that care about that distinction check existence separately.

get_directive(schema, name)

@spec get_directive(t(), String.t()) :: {:ok, TypedGql.Schema.Directive.t()} | :error

get_field(schema, type_name, field_name)

@spec get_field(t(), String.t(), String.t()) ::
  {:ok, TypedGql.Schema.Field.t()} | :error

get_type(schema, name)

@spec get_type(t(), String.t()) :: {:ok, TypedGql.Schema.Type.t()} | :error