mix graphql_query.schema.fetch (graphql_query v0.6.1)
View SourceFetches remote GraphQL schemas and saves them to the local filesystem.
Discovers all modules that use GraphqlQuery.Schema with a :remote configuration
and downloads their schemas from the configured URLs.
Usage
# Fetch all remote schemas
mix graphql_query.schema.fetch
# Fetch a specific schema module
mix graphql_query.schema.fetch MyApp.ExternalSchemaConfiguration
Schema modules must be configured with the :remote option:
defmodule MyApp.ExternalSchema do
use GraphqlQuery.Schema,
remote: [url: "https://api.example.com/schema.graphql"]
endFor APIs that only support introspection (no direct SDL endpoint):
defmodule MyApp.IntrospectedSchema do
use GraphqlQuery.Schema,
remote: [url: "https://api.example.com/graphql", mode: :introspect]
endThe schemas directory can be configured at multiple levels:
- Per-module
:schemas_diroption inuse GraphqlQuery.Schema - Application config:
config :graphql_query, schemas_dir: "priv/graphql/schemas" - Default:
"priv/graphql/schemas"