Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "specifiedBy" #152

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @Code-Hex
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: test
on:
push:
branches:
- "master"
pull_request: {}
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup go
uses: actions/setup-go@v2
with:
go-version: '^1.16.2'
- name: vet
run: go vet ./...
- name: test
run: go test ./...
1 change: 1 addition & 0 deletions ast/directive.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const (
LocationFragmentDefinition DirectiveLocation = `FRAGMENT_DEFINITION`
LocationFragmentSpread DirectiveLocation = `FRAGMENT_SPREAD`
LocationInlineFragment DirectiveLocation = `INLINE_FRAGMENT`
LocationVariableDefinition DirectiveLocation = `VARIABLE_DEFINITION`

// Type System
LocationSchema DirectiveLocation = `SCHEMA`
Expand Down
1 change: 1 addition & 0 deletions ast/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func (d *SchemaDocument) Merge(other *SchemaDocument) {
}

type Schema struct {
Description string
Query *Definition
Mutation *Definition
Subscription *Definition
Expand Down
4 changes: 2 additions & 2 deletions ast/document_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

. "github.com/vektah/gqlparser/v2/ast"
"github.com/vektah/gqlparser/v2/parser"
. "github.com/gqlgo/gqlparser/v2/ast"
"github.com/gqlgo/gqlparser/v2/parser"
)

func TestQueryDocMethods(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion formatter/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sort"
"strings"

"github.com/vektah/gqlparser/v2/ast"
"github.com/gqlgo/gqlparser/v2/ast"
)

type Formatter interface {
Expand Down
8 changes: 4 additions & 4 deletions formatter/formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"testing"
"unicode/utf8"

"github.com/gqlgo/gqlparser/v2"
"github.com/gqlgo/gqlparser/v2/ast"
"github.com/gqlgo/gqlparser/v2/formatter"
"github.com/gqlgo/gqlparser/v2/parser"
"github.com/stretchr/testify/assert"
"github.com/vektah/gqlparser/v2"
"github.com/vektah/gqlparser/v2/ast"
"github.com/vektah/gqlparser/v2/formatter"
"github.com/vektah/gqlparser/v2/parser"
)

var update = flag.Bool("u", false, "update golden files")
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/vektah/gqlparser/v2
module github.com/gqlgo/gqlparser/v2

go 1.13

Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ github.com/agnivade/levenshtein v1.0.1 h1:3oJU7J3FGFmyhn8KHjmVaZCN5hxTr7GxgRue+s
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -20,11 +19,9 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6 h1:iZgcI2DDp6zW5v9Z/5+f0NuqoxNdmzg4hivjk2WLXpY=
golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
2 changes: 1 addition & 1 deletion gqlerror/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"strconv"

"github.com/vektah/gqlparser/v2/ast"
"github.com/gqlgo/gqlparser/v2/ast"
)

// Error is the standard graphql error type described in https://facebook.github.io/graphql/draft/#sec-Errors
Expand Down
2 changes: 1 addition & 1 deletion gqlerror/error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package gqlerror
import (
"testing"

"github.com/gqlgo/gqlparser/v2/ast"
"github.com/stretchr/testify/require"
"github.com/vektah/gqlparser/v2/ast"
)

func TestErrorFormatting(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions gqlparser.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package gqlparser

import (
"github.com/vektah/gqlparser/v2/ast"
"github.com/vektah/gqlparser/v2/gqlerror"
"github.com/vektah/gqlparser/v2/parser"
"github.com/vektah/gqlparser/v2/validator"
_ "github.com/vektah/gqlparser/v2/validator/rules"
"github.com/gqlgo/gqlparser/v2/ast"
"github.com/gqlgo/gqlparser/v2/gqlerror"
"github.com/gqlgo/gqlparser/v2/parser"
"github.com/gqlgo/gqlparser/v2/validator"
_ "github.com/gqlgo/gqlparser/v2/validator/rules"
)

func LoadSchema(str ...*ast.Source) (*ast.Schema, *gqlerror.Error) {
Expand Down
4 changes: 2 additions & 2 deletions lexer/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"bytes"
"unicode/utf8"

"github.com/vektah/gqlparser/v2/ast"
"github.com/vektah/gqlparser/v2/gqlerror"
"github.com/gqlgo/gqlparser/v2/ast"
"github.com/gqlgo/gqlparser/v2/gqlerror"
)

// Lexer turns graphql request and schema strings into tokens
Expand Down
4 changes: 2 additions & 2 deletions lexer/lexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package lexer
import (
"testing"

"github.com/vektah/gqlparser/v2/ast"
"github.com/vektah/gqlparser/v2/parser/testrunner"
"github.com/gqlgo/gqlparser/v2/ast"
"github.com/gqlgo/gqlparser/v2/parser/testrunner"
)

func TestLexer(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion lexer/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package lexer
import (
"strconv"

"github.com/vektah/gqlparser/v2/ast"
"github.com/gqlgo/gqlparser/v2/ast"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package parser
import (
"strconv"

"github.com/vektah/gqlparser/v2/ast"
"github.com/vektah/gqlparser/v2/gqlerror"
"github.com/vektah/gqlparser/v2/lexer"
"github.com/gqlgo/gqlparser/v2/ast"
"github.com/gqlgo/gqlparser/v2/gqlerror"
"github.com/gqlgo/gqlparser/v2/lexer"
)

type parser struct {
Expand Down
4 changes: 2 additions & 2 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package parser
import (
"testing"

"github.com/gqlgo/gqlparser/v2/ast"
"github.com/gqlgo/gqlparser/v2/lexer"
"github.com/stretchr/testify/require"
"github.com/vektah/gqlparser/v2/ast"
"github.com/vektah/gqlparser/v2/lexer"
)

func TestParserUtils(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions parser/query.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package parser

import (
"github.com/vektah/gqlparser/v2/gqlerror"
"github.com/vektah/gqlparser/v2/lexer"
"github.com/gqlgo/gqlparser/v2/gqlerror"
"github.com/gqlgo/gqlparser/v2/lexer"

. "github.com/vektah/gqlparser/v2/ast"
. "github.com/gqlgo/gqlparser/v2/ast"
)

func ParseQuery(source *Source) (*QueryDocument, *gqlerror.Error) {
Expand Down
4 changes: 2 additions & 2 deletions parser/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package parser
import (
"testing"

"github.com/vektah/gqlparser/v2/ast"
"github.com/vektah/gqlparser/v2/parser/testrunner"
"github.com/gqlgo/gqlparser/v2/ast"
"github.com/gqlgo/gqlparser/v2/parser/testrunner"
)

func TestQueryDocument(t *testing.T) {
Expand Down
8 changes: 7 additions & 1 deletion parser/query_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ variables:
locations: [{ line: 1, column: 37 }]

- name: can have directives
input: 'query ($withDirective: String @first @second, $withoutDirective: String) { f }'
input: 'query ($withDirective: String @first @second @third(if: true), $withoutDirective: String) { f }'
ast: |
<QueryDocument>
Operations: [OperationDefinition]
Expand All @@ -57,6 +57,12 @@ variables:
Name: "first"
- <Directive>
Name: "second"
- <Directive>
Name: "third"
Arguments: [Argument]
- <Argument>
Name: "if"
Value: true
- <VariableDefinition>
Variable: "withoutDirective"
Type: String
Expand Down
8 changes: 5 additions & 3 deletions parser/schema.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package parser

import (
. "github.com/vektah/gqlparser/v2/ast"
"github.com/vektah/gqlparser/v2/gqlerror"
"github.com/vektah/gqlparser/v2/lexer"
. "github.com/gqlgo/gqlparser/v2/ast"
"github.com/gqlgo/gqlparser/v2/gqlerror"
"github.com/gqlgo/gqlparser/v2/lexer"
)

func ParseSchema(source *Source) (*SchemaDocument, *gqlerror.Error) {
Expand Down Expand Up @@ -503,6 +503,8 @@ func (p *parser) parseDirectiveLocation() DirectiveLocation {
return LocationFragmentSpread
case `INLINE_FRAGMENT`:
return LocationInlineFragment
case `VARIABLE_DEFINITION`:
return LocationVariableDefinition
case `SCHEMA`:
return LocationSchema
case `SCALAR`:
Expand Down
4 changes: 2 additions & 2 deletions parser/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package parser
import (
"testing"

"github.com/vektah/gqlparser/v2/ast"
"github.com/vektah/gqlparser/v2/parser/testrunner"
"github.com/gqlgo/gqlparser/v2/ast"
"github.com/gqlgo/gqlparser/v2/parser/testrunner"
)

func TestSchemaDocument(t *testing.T) {
Expand Down
64 changes: 60 additions & 4 deletions parser/schema_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,15 @@ type extensions:
schema definition:
- name: simple
input: |
"Description"
schema {
query: Query
}
ast: |
<SchemaDocument>
Schema: [SchemaDefinition]
- <SchemaDefinition>
Description: "Description"
OperationTypes: [OperationTypeDefinition]
- <OperationTypeDefinition>
Operation: Operation("query")
Expand All @@ -280,9 +282,9 @@ schema definition:
schema extensions:
- name: simple
input: |
extend schema {
mutation: Mutation
}
extend schema {
mutation: Mutation
}
ast: |
<SchemaDocument>
SchemaExtension: [SchemaDefinition]
Expand Down Expand Up @@ -519,7 +521,61 @@ directives:
Locations: [DirectiveLocation]
- DirectiveLocation("FIELD")
IsRepeatable: false


- name: executable
input: |
directive @onQuery on QUERY
directive @onMutation on MUTATION
directive @onSubscription on SUBSCRIPTION
directive @onField on FIELD
directive @onFragmentDefinition on FRAGMENT_DEFINITION
directive @onFragmentSpread on FRAGMENT_SPREAD
directive @onInlineFragment on INLINE_FRAGMENT
directive @onVariableDefinition on VARIABLE_DEFINITION
ast: |
<SchemaDocument>
Directives: [DirectiveDefinition]
- <DirectiveDefinition>
Name: "onQuery"
Locations: [DirectiveLocation]
- DirectiveLocation("QUERY")
IsRepeatable: false
- <DirectiveDefinition>
Name: "onMutation"
Locations: [DirectiveLocation]
- DirectiveLocation("MUTATION")
IsRepeatable: false
- <DirectiveDefinition>
Name: "onSubscription"
Locations: [DirectiveLocation]
- DirectiveLocation("SUBSCRIPTION")
IsRepeatable: false
- <DirectiveDefinition>
Name: "onField"
Locations: [DirectiveLocation]
- DirectiveLocation("FIELD")
IsRepeatable: false
- <DirectiveDefinition>
Name: "onFragmentDefinition"
Locations: [DirectiveLocation]
- DirectiveLocation("FRAGMENT_DEFINITION")
IsRepeatable: false
- <DirectiveDefinition>
Name: "onFragmentSpread"
Locations: [DirectiveLocation]
- DirectiveLocation("FRAGMENT_SPREAD")
IsRepeatable: false
- <DirectiveDefinition>
Name: "onInlineFragment"
Locations: [DirectiveLocation]
- DirectiveLocation("INLINE_FRAGMENT")
IsRepeatable: false
- <DirectiveDefinition>
Name: "onVariableDefinition"
Locations: [DirectiveLocation]
- DirectiveLocation("VARIABLE_DEFINITION")
IsRepeatable: false

- name: repeatable
input: directive @foo repeatable on FIELD
ast: |
Expand Down
2 changes: 1 addition & 1 deletion parser/testrunner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"

"github.com/andreyvit/diff"
"github.com/vektah/gqlparser/v2/gqlerror"
"github.com/gqlgo/gqlparser/v2/gqlerror"
"gopkg.in/yaml.v2"
)

Expand Down
8 changes: 7 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
gqlparser [![CircleCI](https://badgen.net/circleci/github/vektah/gqlparser/master)](https://circleci.com/gh/vektah/gqlparser) [![Go Report Card](https://goreportcard.com/badge/github.com/vektah/gqlparser/v2)](https://goreportcard.com/report/github.com/vektah/gqlparser/v2) [![Coverage Status](https://badgen.net/coveralls/c/github/vektah/gqlparser)](https://coveralls.io/github/vektah/gqlparser?branch=master)
Forked gqlparser written by gqlgo [![test](https://github.com/gqlgo/gqlparser/actions/workflows/test.yml/badge.svg)](https://github.com/gqlgo/gqlparser/actions/workflows/test.yml)
===

gqlparser is a graphql parser package for Go. original: [vektah/gqlparser](https://github.com/vektah/gqlparser)

You can see [compare](https://github.com/vektah/gqlparser/compare/master...gqlgo:master) with the original.

## About gqlparser

This is a parser for graphql, written to mirror the graphql-js reference implementation as closely while remaining idiomatic and easy to use.

spec target: June 2018 (Schema definition language, block strings as descriptions, error paths & extension)
Expand Down
Loading