Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 1.42 KB

README.md

File metadata and controls

59 lines (42 loc) · 1.42 KB

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.