Closed marwan38 closed 1 month ago
@marwan38 This PR hasn't been updated for a while. Are you still keen for this feature to be included? If so please address the comments above. If not, I will close this PR.
@GuySartorelli Yeah, still want it included. I've just not dedicated any time to it just yet. If you prefer to close this PR and bring up a new one when I'm ready; that's fine.
There's a few bad commits in here for various different reasons (my own formatters, debug code, etc..).
Sweet. Yes, please feel free to open a new PR when you have a chance to work on this - but I'll close it for now.
This PR is working as intended for my use case and can be merged in. However, I have a note for the maintainers here to make the decision on. I'm currently using this as a patch in our codebase on version 4.13 of this module. I'm hoping that it can be merged in by the time I'm done with our codebase migration and can then bump up to v5 of this module.
SchemaTransciber does not introspect the directives. Therefore users relying on the schema transcriber won't be able to get the full schema including the directives. I can't make the decision on behalf of the framework on how much you want added within the introspection query. I personally don't use it, we generate the schema directly using @graphql-codegen and that introspects what we need. An example of a more comprehensive introspection query can be found here and what the directives field may contain here. That introspect query also adds the complexity of configuration, so I'm not really sure what you guys would want here. As I said, this feature as-is is enough for me at the moment.
Description
Directives are part of the GraphQL specification and this PR adds the Directive type for developers to create custom ones. Ideally, this PR would be followed up (or done alongside) with more integration of directives. One use case i would like to see is adding
deprecationReason
to to types.or if there is any reason to add directives to a field (not sure if this is a valid use case)
Manual testing steps
A new type is added
directives
in the graphql schema yaml file.Viewing the the graphql schema (e.g. using /dev/graphql/ide) should now contain an entry like so:
The configuration of the
Directive
type can be found here https://webonyx.github.io/graphql-php/type-definitions/directives/#custom-directives.The directive can then be resolved within the resolver like so:
Issues
578
Pull request checklist