Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gqlgo/deprecatedquery
`deprecatedquery` finds a deprecated query in your GraphQL query files.
https://github.com/gqlgo/deprecatedquery
Last synced: 9 days ago
JSON representation
`deprecatedquery` finds a deprecated query in your GraphQL query files.
- Host: GitHub
- URL: https://github.com/gqlgo/deprecatedquery
- Owner: gqlgo
- License: mit
- Created: 2022-09-02T07:11:53.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-16T07:36:36.000Z (about 2 years ago)
- Last Synced: 2024-08-02T06:13:51.940Z (3 months ago)
- Language: Go
- Size: 41 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# deprecatedquery
[![pkg.go.dev][gopkg-badge]][gopkg]
`deprecatedquery` finds a deprecated query in your GraphQL query files.
```graphql
# In your schema
type User {
id: ID!
addr: String! @deprecated(reason: "use address instead")
address: String!
}# Query
query user {
user {
addr # want "addr is deprecated reason: use address instead"
}
}
```## 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/deprecatedquery"
"github.com/gqlgo/gqlanalysis/multichecker"
)func main() {
var excludes string
flag.StringVar(&excludes, "excludes", "", "exclude GraphQL query field name. it can specify multiple values separated by `,`")
flag.Parse()multichecker.Main(
deprecatedquery.Analyzer(excludes),
)
}
````deprecatedquery` provides a typical main function and you can install with `go install` command.
```sh
$ go install github.com/gqlgo/deprecatedquery/cmd/deprecatedquery@latest
```The `deprecatedquery` command has two flags, `schema` and `query` which will be parsed and analyzed by deprecatedquery's Analyzer.
```sh
$ deprecatedquery -schema="server/graphql/schema/**/*.graphql" -query="client/**/*.graphql" -excludes="field1,field2"
```The default value of `schema` is "schema/*/**.graphql" and `query` is `query/*/**.graphql`.
`schema` flag accepts URL for a endpoint of GraphQL server.
`deprecatedquery` will get schemas by an introspection query via the endpoint.```sh
$ deprecatedquery -schema="https://example.com" -query="client/**/*.graphql"
```## Author
[![Appify Technologies, Inc.](appify-logo.png)](http://github.com/appify-technologies)
[gopkg]: https://pkg.go.dev/github.com/gqlgo/deprecatedquery
[gopkg-badge]: https://pkg.go.dev/badge/github.com/gqlgo/deprecatedquery?status.svg