graphql-dotnet / graphql-dotnet/conventions

Support custom directives

Open
#159 4 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
228
Forks
62
PR merge metrics
No merged PRs in 30d

Description

It would be nice to add support of custom directives, since currently it is only available via reflection to get `_schema` from `GraphQLEngine` and invoke `RegisterDirective` passing `DirectiveGraphType`.
There are few ways:

- Add public getter to access `_schema`, so that any custom operation wich is possible in _graphql-dotnet_ will be possible with _graphql-dotnet conventions_
- this is the simplest but cons is that it only possible after `BuildSchema` executed
- Intoduce `WithDirective(DirectiveGraphType)` method which will be just a proxy to `_schema`
- it can remember provided type until `BuildSchema` is called or register directory immediately to `_schema` if it is already constructed
- Add adapter as for Queries and Mutations so that is would be possible to describe directive like a class:
```cs
[Name('mydircetive')]
[DirectiveLocations(DirectiveLocation.Field)]
class Directive {
public int Count { get; set; } // some argument
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.