GraphqlMarkdown (Graphql Markdown v1.1.0)

Copy Markdown View Source

Converts a GraphQL JSON schema to a markdown format

Summary

Types

Rendered pages, keyed by filename (for example "graphql_schema.md").

Functions

Renders the markdown and writes it into :output_dir (default: the current directory). Returns the list of files written.

Renders the markdown in memory and returns it keyed by filename.

Types

error()

@type error() :: :invalid_schema | File.posix() | Jason.DecodeError.t()

pages()

@type pages() :: %{required(String.t()) => String.t()}

Rendered pages, keyed by filename (for example "graphql_schema.md").

Functions

generate(options)

@spec generate(keyword()) :: {:ok, [Path.t()]} | {:error, error()}

Renders the markdown and writes it into :output_dir (default: the current directory). Returns the list of files written.

Files are written only after every page has been rendered, so a failure never leaves a partially written file behind.

render(options)

@spec render(keyword()) :: {:ok, pages()} | {:error, error()}

Renders the markdown in memory and returns it keyed by filename.

Nothing is written to disk. Use this to embed the generator in your own pipeline or to inspect the output in tests.

Accepts the same options as generate/1 except :output_dir.