ExShopifySchema.Generator.Graphql.Introspection.Util.Builder (ExShopifySchema v2025.1.3)
View SourceUtility module for building GraphQL components from introspection JSON data.
Summary
Functions
Builds a list of directives from the introspection JSON data.
Builds a list of operation types from the introspection JSON data.
Builds a list of GraphQL types from the introspection JSON data.
Functions
@spec build_directives(nil | [json_object()]) :: [ ExShopifySchema.Generator.Graphql.Introspection.Definition.Directive.t() ]
Builds a list of directives from the introspection JSON data.
Example
iex> json = [
...> %{"name" => "include", "description" => "Include this field if true."},
...> %{"name" => "skip", "description" => "Skip this field if true."}
...> ]
iex> ExShopifySchema.Graphql.Introspection.Util.Builder.build_directives(json)
[
%ExShopifySchema.Graphql.Introspection.Definition.Directive{name: "include", description: "Include this field if true."},
%ExShopifySchema.Graphql.Introspection.Definition.Directive{name: "skip", description: "Skip this field if true."}
]
@spec build_operations(json_object()) :: [ ExShopifySchema.Generator.Graphql.Introspection.Definition.OperationType.t() ]
Builds a list of operation types from the introspection JSON data.
Example
iex> json = %{
...> "query_type" => "RootQuery",
...> "mutation_type" => "Mutation",
...> "subscription_type" => "Subscription"
...> }
iex> ExShopifySchema.Graphql.Introspection.Util.Builder.build_operations(json)
[
%ExShopifySchema.Graphql.Introspection.Definition.OperationType{operation: "query", type: "RootQuery"},
%ExShopifySchema.Graphql.Introspection.Definition.OperationType{operation: "mutation", type: "Mutation"},
%ExShopifySchema.Graphql.Introspection.Definition.OperationType{operation: "subscription", type: "Subscription"}
]
@spec build_types([json_object()]) :: [ ExShopifySchema.Generator.Graphql.Introspection.Definition.type() ]
Builds a list of GraphQL types from the introspection JSON data.
Example
iex> json = [
...> %{"kind" => "SCALAR", "name" => "String"}
...> ]
iex> ExShopifySchema.Graphql.Introspection.Util.Builder.build_types(json)
[
%ExShopifySchema.Graphql.Introspection.Definition.ScalarType{name: "String"}
]