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

GraphQL Directives #578

Open
4 tasks done
marwan38 opened this issue Mar 21, 2024 · 2 comments
Open
4 tasks done

GraphQL Directives #578

marwan38 opened this issue Mar 21, 2024 · 2 comments

Comments

@marwan38
Copy link

marwan38 commented Mar 21, 2024

Description

Directives are a fundamental part of GraphQL and as such I believe should be part of the base providing of any GraphQL implementation. It should be fairly straight forward to add as it's not much different from adding a new type, or interface, etc. Happy to do it with a bit of guidance.

Additional context or points of discussion

I would not ask or bother with this feature were I able to access the GraphQL schema directly during schema build, but I haven't been able to achieve that as the schema instance is generated right before generating the schema (as far as I understood the source code). If we can expose the schema, I'd prefer doing that as it's much less work Adding a directive is as easy as:

<?php
use GraphQL\Type\Definition\Directive;

$directive = new Directive($config);
$graphqlSchema->directives[] = $directive;

That is all.

Validations

  • You intend to implement the feature yourself
  • You have read the contributing guide
  • You strongly believe this feature should be in core, rather than being its own community module
  • You have checked for existing issues or pull requests related to this feature (and didn't find any)

PRs

@maxime-rainville
Copy link
Contributor

Honestly, it's unlikely we'll be able to prioritise this feature. Would you be keen to implement it yourself?

@marwan38
Copy link
Author

Honestly, it's unlikely we'll be able to prioritise this feature. Would you be keen to implement it yourself?

That's my intention. I just hope I can make the time to do it.

It's taking me quite a long time, migrating our codebase across to graphql 4+. It's been over two months so at this point I'm trying to workaround the little things that have a decent workaround.

I do think directives are quite valuable (just the basic @deprecatedReason is useful). Client side directives are also used (Apollo graphql) to handle certain use cases. They are also a part of the graphql specification.

No promises, but.. we'll see after I finish my current task.

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

No branches or pull requests

3 participants