nopermission

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 4 Imported by: 0

README

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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Analyzer

func Analyzer(excludes string) *gqlanalysis.Analyzer

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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