Git Product home page Git Product logo

nodecheck's Introduction

nodecheck

pkg.go.dev

nodecheck will find any GraphQL schema that is not conform to Node interface.

# Valid
type User implements Node {
  id: ID!
}

# Invalid. not conform to Node
type Community {
  name: String!
}

# Invalid. not conform to Node but id is exist 
type Item {
  id: ID!
}

How to use

A runnable linter can be created with multichecker package. You can create own linter with your favorite Analyzers. And nodecheck has independ flag for allow exclude types of nodecheck.

Full example

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 := nodecheck.Analyzer(excludes)

	multichecker.Main(
		analyzer,
	)
}

nodecheck provides a executable binary. So, you can get cmd tool via go install command.

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

The nodecheck command receive two flags, schema and excludes. excludes can specify with regex format and it can receive multiple arguments separated by ','.

$ nodecheck -schema="server/graphql/schema/**/*.graphql" -excludes=.+Connection,.+Edge

Author

Appify Technologies, Inc.

nodecheck's People

Stargazers

yorifuji avatar Yusaku Inoue avatar Shuya Motouchi avatar sonatard avatar

Watchers

mosa avatar syumai avatar Yamashou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.