View Source AbsintheLinter (absinthe_linter v0.2.1)
Validate Absinthe GraphQL schema definitions against a set of rules.
Ported from https://github.com/cjoudrey/graphql-schema-linter
installation
Installation
def deps do
[
{:absinthe_linter, "~> 0.1.0"}
]
end
usage
Usage
This linter adds phases in your Absinthe schema compilation. So, when your schema compiles it'll be linted.
In your Absinthe schema file you need to add a pipeline modifier with AbsintheLinter.
defmodule Schema do
use Absinthe.Schema
@pipeline_modifier AbsintheLinter
query do
end
end
If you need more control, you can add your own pipeline modifier module. E.g.
defmodule Schema do
use Absinthe.Schema
@pipeline_modifier {__MODULE__, :custom_linting_rules}
query do
end
def custom_linting_rules(pipeline) do
pipeline
|> Absinthe.Pipeline.insert_after(
Absinthe.Phase.Schema.Validation.UniqueFieldNames,
[
AbsintheLinter.Rules.DeprecationsHaveReason,
]
)
end
end
See the documentation for the rules.
Link to this section Summary
Functions
The default rules are
Link to this section Functions
The default rules are:
Link to this function
pipeline(pipeline, rules \\ [AbsintheLinter.Rules.DeprecationsHaveReason, AbsintheLinter.Rules.EnumValuesHaveDescriptions, AbsintheLinter.Rules.EnumValuesSortedAlphabetically, AbsintheLinter.Rules.RequireNonNullListsOfNonNull], opts \\ [])
View SourceDefault pipeline, applies all default rules