---
name: "GraphQL::Directive"
section: "3pm"
platform: "linux"
package: "libgraphql-perl"
version: "0.54-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/GraphQL::Directive"
---

# GraphQL::Directive(3pm)

GraphQL directive

## NAME

GraphQL::Directive - GraphQL directive

## SYNOPSIS

```
  use GraphQL::Directive;
  my $directive = GraphQL::Directive->new(
    name => 'Object',
    interfaces => [ $interfaceType ],
    fields => { field_name => { type => $scalar_type, resolve => sub { '' } }},
  );
```

## ATTRIBUTES

Has `"name"`, `"description"` from GraphQL::Role::Named.

### locations

Array-ref of locations where the directive can occur. Must be one of these strings:

```
  QUERY
  MUTATION
  SUBSCRIPTION
  FIELD
  FRAGMENT_DEFINITION
  FRAGMENT_SPREAD
  INLINE_FRAGMENT
  SCHEMA
  SCALAR
  OBJECT
  FIELD_DEFINITION
  ARGUMENT_DEFINITION
  INTERFACE
  UNION
  ENUM
  ENUM_VALUE
  INPUT_OBJECT
  INPUT_FIELD_DEFINITION
```

### args

Hash-ref of arguments. See "FieldMapInput" in GraphQL::Type::Library.

## METHODS

### from\_ast

See "from\_ast" in GraphQL::Type.

## PACKAGE VARIABLES

### $GraphQL::Directive::DEPRECATED

### $GraphQL::Directive::INCLUDE

### $GraphQL::Directive::SKIP

### @GraphQL::Directive::SPECIFIED\_DIRECTIVES

Not exported. Contains the three GraphQL-specified directives: `@skip`, `@include`, `@deprecated`, each of which are available with the variables above. Use if you want to have these plus your own directives in your schema:

```
  my $schema = GraphQL::Schema->new(
    # ...
    directives => [ @GraphQL::Directive::SPECIFIED_DIRECTIVES, $my_directive ],
  );
```
