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

Custom directives are stripped during schema printting? #1072

Closed
dotansimha opened this issue Oct 31, 2017 · 2 comments
Closed

Custom directives are stripped during schema printting? #1072

dotansimha opened this issue Oct 31, 2017 · 2 comments

Comments

@dotansimha
Copy link
Member

dotansimha commented Oct 31, 2017

Trying to understand why my custom GraphQL directives are stripped when printSchema is executed (also using ``).

Found this line of code (isSpecDirective):

export function printIntrospectionSchema(schema: GraphQLSchema): string {
return printFilteredSchema(schema, isSpecDirective, isIntrospectionType);
}
function isSpecDirective(directiveName: string): boolean {
return (
directiveName === 'skip' ||
directiveName === 'include' ||
directiveName === 'deprecated'
);
}

Is there a reason for removing custom directives? I understand the @deprecated is a special directive and it effects more than just the docs, but I want to implement a custom directive such as skip or include - but the printer/introspection removes them.

@mrjj
Copy link

mrjj commented Nov 9, 2017

There were an answer on this:
#869

@leebyron
Copy link
Contributor

leebyron commented Dec 7, 2017

@skip and @include cannot be added as custom directives - they will always be implemented using the built-in spec-compliant versions.

Other custom directives will be included. I've just added a test which confirms this

leebyron pushed a commit that referenced this issue Dec 7, 2017
* Include test that printSchema includes non-spec directives. Closes #1072

* fix broken link on README.md
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