Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gqlgo/optionalschema
`optionalschema` finds optional fields and arguments in your GraphQL schema files.
https://github.com/gqlgo/optionalschema
Last synced: 9 days ago
JSON representation
`optionalschema` finds optional fields and arguments in your GraphQL schema files.
- Host: GitHub
- URL: https://github.com/gqlgo/optionalschema
- Owner: gqlgo
- License: mit
- Created: 2022-09-03T14:04:51.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-16T07:41:46.000Z (about 2 years ago)
- Last Synced: 2024-08-02T06:14:09.152Z (3 months ago)
- Language: Go
- Size: 32.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# optionalschema
[![pkg.go.dev][gopkg-badge]][gopkg]
`optionalschema` finds optional fields and arguments in your GraphQL schema files.
```graphql
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.```go
package mainimport (
"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.
```sh
$ 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.
```sh
$ optionalschema -schema="server/graphql/schema/**/*.graphql" -excludes="field1,field2"
```The default value of `schema` is "schema/*/**.graphql".
## Author
[![Appify Technologies, Inc.](appify-logo.png)](http://github.com/appify-technologies)
[gopkg]: https://pkg.go.dev/github.com/gqlgo/optionalschema
[gopkg-badge]: https://pkg.go.dev/badge/github.com/gqlgo/optionalschema?status.svg