Skip to content

`optionalschema` finds optional fields and arguments in your GraphQL schema files.

License

Notifications You must be signed in to change notification settings

gqlgo/optionalschema

Repository files navigation

optionalschema

pkg.go.dev

optionalschema finds optional fields and arguments in your GraphQL schema files.

type Query {
    field: String!
    optionalField: String # want "optionalField is optional"
}

How to use

A runnable linter can be created with multichecker package. You can create own linter with your favorite Analyzers.

package main

import (
	"flag"
	"github.com/gqlgo/optionalschema"
	"github.com/gqlgo/gqlanalysis/multichecker"
)

func main() {
	var excludes string
	flag.StringVar(&excludes, "excludes", "", "exclude GraphQL schema type name. it can specify multiple values separated by `,`")
	flag.Parse()

	multichecker.Main(
		optionalschema.Analyzer(excludes),
	)
}

optionalschema provides a typical main function and you can install with go install command.

$ go install github.com/gqlgo/optionalschema/cmd/optionalschema@latest

The optionalschema command has a flag, schema which will be parsed and analyzed by optionalschema's Analyzer.

$ optionalschema -schema="server/graphql/schema/**/*.graphql" -excludes="field1,field2"

The default value of schema is "schema/*/**.graphql".

Author

Appify Technologies, Inc.

About

`optionalschema` finds optional fields and arguments in your GraphQL schema files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages