Skip to content

Latest commit

 

History

History
61 lines (43 loc) · 1.51 KB

README.md

File metadata and controls

61 lines (43 loc) · 1.51 KB

nopermission

pkg.go.dev

nopermission finds types and interfaces with no @hasPermission directive in your GraphQL schema files.

type ObjectWithoutPermission { # want "ObjectWithoutPermission has no hasPermission directive"
    id: ID!
    field: String!
}

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/builtbystack/nopermission"
	"github.com/gqlgo/gqlanalysis/multichecker"
)

func main() {
	var excludes string
	flag.StringVar(&excludes, "excludes", "", "exclude GraphQL types for node check. it can specify multiple values separated by `,` and it can use regex(e.g .+Connection")
	flag.Parse()

	analyzer := nopermission.Analyzer(excludes)

	multichecker.Main(
		analyzer,
	)
}

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

$ go install github.com/builtbystack/nopermission/cmd/nopermission@latest

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

$ nopermission -schema="server/graphql/schema/**/*.graphql"

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

Author

Appify Technologies, Inc.