question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document: Adding custom directives

See original GitHub issue

It is possible to pass custom directives to graphql-core but it’s not documented anywhere. It should be.

from graphql.types.directives import specified_directives  # <== default directives
from graphene import Schema

schema = Schema(query=Query, directives=specified_directives + [MyDirective])

@skip and @include and defined here: https://github.com/graphql-python/graphql-core/blob/8f7c8f3351dd0a4580b87f293aed7bfcf9126bc4/graphql/type/directives.py#L69-L98

Originally raised in https://github.com/graphql-python/graphene/issues/1006

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:7

github_iconTop GitHub Comments

8reactions
karlossscommented, Oct 9, 2020

Is it possible that the documentation on writing custom directives is still missing, or I am just unable to find it?

0reactions
stale[bot]commented, Mar 31, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use and create custom directives in Angular
We will create our own custom directives as well. ... Create an app-highlight.directive.ts file in src/app folder and add the code snippet ...
Read more >
Creating a Custom Directive • Angular - codecraft.tv
We create a directive by decorating a class with the @Directive decorator. The convention is to associate a directive to an element via...
Read more >
Documentation on adding custom directives #446 - GitHub
I'm looking to create a custom directive for my GraphQL server. I want my server to omit certain fields conditionally, based on the...
Read more >
How to Create & Use Custom Directive In Angular
The Angular has several built-in attribute directives. Let us create a ttClass directive, which allows us to add class to an element. Similar...
Read more >
Walkthrough: Creating a Custom Directive Processor
In this walkthrough, you create a custom directive processor. You add a custom directive that reads an XML file, stores it in an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found