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

Schema directives at field definitions are lost when a schema is parsed and printed #2389

Closed
pmantica1 opened this issue Jan 24, 2020 · 2 comments

Comments

@pmantica1
Copy link

pmantica1 commented Jan 24, 2020

Thanks for the help on the previous issue!

I noticed that all directives at field definitions, (excepted for the @deprecated directive), are lost when a schema is parsed and printed. Essentially, I noticed the following issue:

const graphql = require("graphql");
schema = `
directive @custom_directive(a: Int) on FIELD_DEFINITION
type Object {
  a : Int @custom_directive(a: 1)
}
`
console.log(graphql.printSchema(graphql.buildASTSchema(graphql.parse(schema))));
# directive @custom_directive(a: Int) on FIELD_DEFINITION
# 
# type Object {
#   a: Int
# }

As you can see the @custom_directive gets lost.

Please let me know what you think.

PS: I am using graphql@15.0.0-alpha.2.

@m14t
Copy link
Contributor

m14t commented Feb 7, 2020

Possibly related to or duplicate of #2020.

@IvanGoncharov
Copy link
Member

@pmantica1 Thanks for taking the time to report this 👍
@m14t Is absolutely correct this is duplicate of #552 and I fully agree that this is surprising behavior and should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants