Builds the details of an example operation (query, mutation or subscription): its name, arguments and the selection set to request.
The selection set recurses into object, interface and union types down to
a configurable depth, selecting scalar and enum leaves, so that the example
is valid GraphQL. A field whose type is already selected further up the
same path is skipped, which breaks cycles such as friends: [Character].
Summary
Types
One entry of a selection set: a field, or an inline fragment on a possible
type of an interface or union. Leaves have an empty selections list.
Functions
The number of nested selection-set levels an example operation contains by default.
Creates a map with the details of an operation: the operation type and name, its arguments, its (unwrapped) return type and the selection set.
Types
@type graphql_operation_details() :: %{ operation_type: String.t(), operation_name: String.t(), arguments: [argument()], return_type: return_type(), selections: [selection()] }
@type selection() :: %{name: String.t(), selections: [selection()]} | %{on: String.t(), selections: [selection()]}
One entry of a selection set: a field, or an inline fragment on a possible
type of an interface or union. Leaves have an empty selections list.
Functions
@spec default_depth() :: pos_integer()
The number of nested selection-set levels an example operation contains by default.
@spec generate_operation_details( String.t(), map(), GraphqlMarkdown.Schema.t(), keyword() ) :: graphql_operation_details()
Creates a map with the details of an operation: the operation type and name, its arguments, its (unwrapped) return type and the selection set.
Options:
:depth- how many nested selection-set levels to generate (default 2).1selects only the leaves of the return type.