Artifact image

Function Directives

The GraphQL schema is provided with directives which expose functionalities commonly found in programming languages (such as PHP).

Directive fields are useful for manipulating the data once it has been retrieved, allowing us to transform a field value in whatever way it is required, and granting us powerful data import/export capabilities.

For instance, this query:

query {
  posts {
    title @strUpperCase
  }
}

...will produce this response:

{
  "data": {
    "posts": [
      {
        "title": "HELLO WORLD!"
      },
      {
        "title": "LOVELY WEATHER"
      }
    ]
  }
}