GraphqlQuery.Schema.Absinthe (graphql_query v0.6.2)

View Source

Utilities for extracting schema information from Absinthe schemas.

This module provides functions to convert Absinthe schema definitions into inspectable string representations for analysis and validation.

Summary

Functions

Extracts schema information from an Absinthe schema.

Extracts schema information from an Absinthe schema and returns it as a string.

Functions

schema_from_absinthe(schema)

@spec schema_from_absinthe(module()) :: {:ok, String.t()} | {:error, String.t()}

Extracts schema information from an Absinthe schema.

This function processes an Absinthe schema through the schema pipeline to generate a blueprint representation.

Parameters

  • schema - An Absinthe schema module

Returns

  • {:ok, string} - Success with the schema blueprint as a string
  • {:error, reason} - Error with failure reason

Examples

iex> GraphqlQuery.Schema.Absinthe.schema_from_absinthe(MyApp.Schema)
{:ok, "type Query { ... }"}

iex> GraphqlQuery.Schema.Absinthe.schema_from_absinthe(InvalidSchema)
{:error, "Failed to render schema"}

schema_from_absinthe!(schema)

@spec schema_from_absinthe!(module()) :: String.t()

Extracts schema information from an Absinthe schema and returns it as a string.

Raises an exception if the schema extraction fails.

Parameters

  • schema - An Absinthe schema module

Returns

A string representation of the schema blueprint.

Raises

Raises a runtime error if schema extraction fails.

Examples

iex> GraphqlQuery.Schema.Absinthe.schema_from_absinthe!(MyApp.Schema)
"type Query { ... }"