You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/type_definitions/directives.md
+20Lines changed: 20 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -54,8 +54,28 @@ class MySchema < GraphQL::Schema
54
54
end
55
55
```
56
56
57
+
And you can reference them in the query with `@directive_name(...)`:
58
+
59
+
```ruby
60
+
query {
61
+
field @directive_name {
62
+
id
63
+
}
64
+
}
65
+
```
66
+
57
67
{{ "GraphQL::Schema::Directive::Feature" | api_doc }} and {{ "GraphQL::Schema::Directive::Transform" | api_doc }} are included in the library as examples.
58
68
69
+
### Custom Name
70
+
71
+
By default, the directive's name is taken from the class name. You can override this with `graphql_name`, for example:
0 commit comments