gqlfetch

package module
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 13 Imported by: 15 modules, 11 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

GQLFetch

GraphQL introspection based schema generator, introspection query document mirrors the graphql-js getIntrospectionQuery document albeit compliant to the June 2018 specification.

Usage

import (
	"github.com/suessflorian/gqlfetch"
)

func main() {
	schema, _ := gqlfetch.BuildClientSchema(ctx, endpoint)
}
Or use as cli tool

Introduced a directory here /gqlfetch which will create a gqlfetch cli tool.

go install github.com/suessflorian/gqlfetch/gqlfetch
# gqlfetch --help
gqlfetch --endpoint "localhost:8080/query" > schema.graphql

If you get an error claiming that gqlfetch cannot be found or is not defined, you may need to add ~/go/bin to your $PATH (MacOS/Linux), or %HOME%\go\bin (Windows).

Roadmap

Hoping to incorporate this into a graphql utility package like gqlparser, enable introspection based type-safe graphql client generation in genqlient and simplify the Service type federated services need to expose to a bramble gateway (improving the schema gathering logic).

Notice

Project not fully mature yet, if you find any issues, please submit an issue.

Documentation

Index

Constants

View Source
const (
	NON_NULL introspectionTypeKind = "NON_NULL"
	LIST     introspectionTypeKind = "LIST"
	OBJECT   introspectionTypeKind = "OBJECT"
)

Variables

This section is empty.

Functions

func BuildClientSchema

func BuildClientSchema(ctx context.Context, endpoint string, withoutBuiltins bool) (string, error)

func BuildClientSchemaFromFile

func BuildClientSchemaFromFile(
	ctx context.Context,
	filePath string,
	withoutBuiltins bool,
) (string, error)

func BuildClientSchemaWithHeaders

func BuildClientSchemaWithHeaders(ctx context.Context, endpoint string, headers http.Header, withoutBuiltins bool) (string, error)

func BuildClientSchemaWithOptions

func BuildClientSchemaWithOptions(ctx context.Context, options BuildClientSchemaOptions) (string, error)

Types

type BuildClientSchemaOptions

type BuildClientSchemaOptions struct {
	Endpoint        string
	Method          string
	Headers         http.Header
	WithoutBuiltins bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL