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

Better support for custom directives #915

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yanns
Copy link
Contributor

@yanns yanns commented Oct 6, 2022

Prototype for #913

This prototype is a version of #916 that tries to re-use DirectiveLocation

Prototype for #913
In this prototype, we check how we can apply custom directives much easier.
Furthermore, we check if we can prove type safety, to that a custom directive
that can be applied on some elements cannot be applied on others.

Limitations:
- a directive can be applied on a field definition for example. With that current approach,
we cannot formulate that with the type system as a field definition lives in sangria.ast, and
we only handle sangria.schema types.
- we are introducing new types to mark on which elements a directive can be applied. Those types
are kind of duplication of the current [sangria.schema.DirectiveLocation values](https://github.com/sangria-graphql/sangria/blob/f339b5df97bd89c2a24fcfc977a1f20191ffd7fc/modules/core/src/main/scala/sangria/schema/Schema.scala#L1136-L1158).
@yanns yanns force-pushed the custom_directive_API_reuse_DirectiveLocation branch from 5378438 to 67adcbb Compare October 6, 2022 08:39
@yanns yanns changed the title does not compile Better support for custom directives Oct 6, 2022
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

Successfully merging this pull request may close these issues.

None yet

1 participant