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

Are directive arguments checked in validation #107

Closed
MichaelJCompton opened this issue Aug 8, 2019 · 0 comments · Fixed by dgraph-io/gqlparser#2 or #258
Closed

Are directive arguments checked in validation #107

MichaelJCompton opened this issue Aug 8, 2019 · 0 comments · Fixed by dgraph-io/gqlparser#2 or #258
Labels
bug Something isn't working

Comments

@MichaelJCompton
Copy link

MichaelJCompton commented Aug 8, 2019

I thought the following example would result in validation errors, but it passes without error.

Are directive arguments not checked by validation? ...or have I done something silly?

package main

import (
	"github.com/vektah/gqlparser/ast"
	"github.com/vektah/gqlparser/parser"
	"github.com/vektah/gqlparser/validator"
)

func main() {
	schema := `
scalar Int
directive @foo(bla: Int!) on FIELD_DEFINITION

type P {
	f: Int @foo(bla: "asdf")
	g: Int @foo(notblaa: "asdf")
	h: Int @foo
}
`

	doc, gqlErr := parser.ParseSchema(&ast.Source{Input: schema})
	if gqlErr != nil {
		panic(gqlErr)
	}

	_, gqlErr = validator.ValidateSchemaDocument(doc)
	if gqlErr != nil {
		panic(gqlErr)
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants