-
In early version, GraphQL-tools had this concept of decorators Generally, there is a huge demand for GraphQL to support. For example: Why not directives. This blog post sums it up: Generally, directives need to be defined in the schema and they are often misused. Solutions to resolve this problem were created already and it will be cool if there will be possibility to include them into graphql-tools. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
I do not know the entire evolution, but decorator proposal seems to have morphed into the schema directive implementation. The old class based system is still supported, as is the new functional approach. In general, upstream graphql-js suggests adding metadata to extensions properties. |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for quick response. |
Beta Was this translation helpful? Give feedback.
-
You could use the new functional schemaTransform approach to convert between your comment syntax and directive syntax, advantage to using directives is that with appropriate use of typeDefs, everything is typed so can be validated easily. |
Beta Was this translation helpful? Give feedback.
-
@yaacovCR actually this sound like amazing idea. I will try this out |
Beta Was this translation helpful? Give feedback.
I do not know the entire evolution, but decorator proposal seems to have morphed into the schema directive implementation. The old class based system is still supported, as is the new functional approach.
In general, upstream graphql-js suggests adding metadata to extensions properties.