Documentation
¶
Overview ¶
Package graphql translates a GraphQL schema into callable operations.
The translation differs from REST in one fundamental way, and that decides the design: in REST, calling an endpoint returns a whole document; in GraphQL, **the caller chooses what comes back**. There is no "call it and see what arrives" — without a field selection the server rejects the request.
So each Query/Mutation field becomes a tool whose selection WE assemble: the scalar fields of the return type, descending while it is worth it. An optional argument lets the model ask for something else when the default does not fit. The common alternative — exposing one `graphql(query)` tool and letting the model write the whole query — hands it work the schema already answers, and that is where this kind of integration usually goes wrong.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
Endpoint string // where queries go (required: the schema does not say)
Auth auth.Applier
Client *http.Client
Headers map[string]string
Depth int // how deep the automatic selection descends; 0 uses the default
}
Options are decisions made by whoever starts the server.