class GraphQL::Schema::Directive::Transform

An example directive to show how you might interact with the runtime.

This directive takes the return value of the tagged part of the query, and if the named transform is whitelisted and applies to the return value, it’s applied by calling a method with that name.

Examples

Example: Installing the directive

class MySchema < GraphQL::Schema
  directive(GraphQL::Schema::Directive::Transform)
end

Example: Transforming strings

viewer {
  username @transform(by: "upcase")
}