Skip to content

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

Closed
@pmantica1

Description

@pmantica1

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 [email protected].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions