mix absinthe.gen.schema (absinthe_generator v0.1.1) View Source

Generates an Absinthe Schema

Options

  • :app_name - Required. Application name you're generating the code under

  • :moduledoc - Moduledoc message can be injected into the resulting output code

  • :queries - List of query namespaces The default value is [].

  • :mutations - List of mutation namespaces The default value is [].

  • :subscriptions - List of subscription namespaces The default value is [].

  • :types - List of types The default value is [].

  • :data_sources - List of %AbsintheGenerator.Schema.DataSource{} The default value is [].

  • :pre_middleware - List of %AbsintheGenerator.Schema.Middleware{} The default value is [].

  • :post_middleware - List of %AbsintheGenerator.Schema.Middleware{} The default value is [].

Specifying Middleware

To specify middleware we can utilize the following syntax

pre_middleware:mutation:AuthMiddleware post_middleware:all:ChangesetErrorFormatter

Middleware can be set for mutation, query, subscription or all and can also be set to either run pre or post resolution using pre_middleware or post_middleware

Example

mix absinthe.gen.schema pre_middleware:mutation:MyMiddlwareModule post_middleware:all:MyAllMiddleware
  --app-name MyApp
  --query test
  --query user
  --mutation user
  --mutation session
  --type MyApp
  --moduledoc "this is the test"
  --data-source "EctoSchemas.Cats"

Link to this section Summary

Functions

Callback implementation for Mix.Task.run/1.

Link to this section Functions

Callback implementation for Mix.Task.run/1.