- Docs
- API reference
- Endpoints and schemas
- GraphQL
- Directives
@upper
Converts a string or each string in an array to uppercase.
Directives. This directive runs after the query has its answer. It changes what you see, not what the query reads.
Converts a string or each string in an array to uppercase. Example: _fn @upper(ref: “name”) returns the uppercased value of ‘name’.
Arguments
Section titled “Arguments”| Argument | Type | Description |
|---|---|---|
ref |
String |
A dot path to one value in the response, relative to the object that holds _fn. Each segment is a field name or alias, a list index, or * for every item of a list. Write ref or refs as the first argument of the directive. |
refs |
[String!] |
A list of dot paths, written as for ref. The directive takes the list of their values as its input. In a chain of directives, only the first directive reads ref or refs, and each later directive takes the output of the one before it. |
Where it goes
Section titled “Where it goes”FIELD.
Example
Section titled “Example”query { search(searchInput: { entityType: BRAND name: "Safeway" conditions: { limit: 1 } }) { ... on Brand { id name: _fn @upper(refs: ["names.edges.0.node.name"]) names(first: 1) { edges { node { name } } } } }}Response, as returned:
{ "data": { "search": [ { "id": "0f26fbef-3436-4f85-8bcd-31fe12a4f99a", "name": [ "SAFEWAY" ], "names": { "edges": [ { "node": { "name": "SAFEWAY" } } ] } } ] }}