Documentation ¶
Index ¶
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func GetQuery ¶
func GetQuery(sv SpecVersion) string
GetQuery returns a GraphQL introspection query that is compatible with the given version of the GraphQL spec.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client capable of issuing an introspection query against a GraphQL server over HTTP, and transforming the response into either an *ast.Schema.
func NewClient ¶
func NewClient(endpoint string, headers http.Header, specVersion SpecVersion, traceOut io.Writer) *Client
NewClient returns a new GraphQL introspection client. HTTP requests issued by this client will use the given HTTP headers, in addition to some defaults. The given SpecVersion will be used to ensure that the introspection query issued by the client is compatible with a specific version of the GraphQL spec. If traceOut is non-nil, the outbound request and returned response will be dumped to it for debugging purposes.
type Directive ¶
type Directive struct { Name string `json:"name"` Description string `json:"description,omitempty"` Locations []DirectiveLocation `json:"locations"` Args []InputValue `json:"args"` IsRepeatable bool `json:"isRepeatable"` }
type DirectiveLocation ¶
type DirectiveLocation string
type GraphQLParams ¶
type InputValue ¶
type IntrospectionQueryResult ¶
type IntrospectionQueryResult struct {
Schema Schema `json:"__schema"`
}
type SpecVersion ¶
type SpecVersion struct { HasSpecifiedByURL bool HasIsRepeatable bool HasSchemaDescription bool // contains filtered or unexported fields }
SpecVersion represents a version of the GraphQL specification. Versions are listed at https://spec.graphql.org/
func ParseSpecVersion ¶
func ParseSpecVersion(raw string) (SpecVersion, error)
type Type ¶
type Type struct { Kind TypeKind `json:"kind"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` // OBJECT and INTERFACE only Fields []Field `json:"fields,omitempty"` // OBJECT only Interfaces []Type `json:"interfaces,omitempty"` // INTERFACE and UNION only PossibleTypes []Type `json:"possibleTypes,omitempty"` // ENUM only EnumValues []EnumValue `json:"enumValues,omitempty"` // INPUT_OBJECT only InputFields []InputValue `json:"inputFields,omitempty"` // NON_NULL and LIST only OfType *Type `json:"ofType,omitempty"` }