-
-
Notifications
You must be signed in to change notification settings - Fork 138
Generate schema with directive at field #90
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
Comments
As I was debugging, I saw that |
Currently, you can add custom directives only via SDL, like this: schema = build_schema("""
directive @hasPermissions(permissions: [String]) on OBJECT | FIELD_DEFINITION
type MyType {
field1: Boolean @hasPermissions(permissions: ["permission1", "permission2"])
}
type Query {
myType: MyType
}
""") Arguably, this is also the only case where such directives are needed. On your hand-made object types, you can simply use a There are long discussions about this in JavaScript land e.g. here and here. The goal of graphql-core is to be a 1:1 port of GraphQL.js. If you have good reasons to add a feature, you can advocate this to the GraphQL.js folks which have great expertise and experience. If they agree it makes sense, it will be eventually implemented there and then ported over here. |
Feature requests
Hi all, I'm trying to generate a schema that has a directive at a field:
However, I did not found a way to generate this using the library. For instance, I tried defining the
directives
attribute fromGraphQLField.ast_node
butprint_schema
did not generated field with the directive:Output:
Is there any way to generate a schema with directive at the field declaration? If not, I can contribute on that.
The text was updated successfully, but these errors were encountered: