# `AshGraphql.Type`
[🔗](https://github.com/ash-project/ash_graphql/blob/v1.9.4/lib/type.ex#L5)

Callbacks used to enrich types with GraphQL-specific metadata.

# `graphql_define_type?`
*optional* 

```elixir
@callback graphql_define_type?(Ash.Type.constraints()) :: false
```

Used for maps/enums/unions that *would* define a type automatically, to disable them.

# `graphql_describe_enum_value`
*optional* 

```elixir
@callback graphql_describe_enum_value(atom()) :: String.t() | nil
```

Used for `Ash.Type.Enum` to provide a description for individual values. For example:

```elixir
defmodule MyEnum do
use Ash.Type.Enum, values: [:foo, :bar, :baz]

  def graphql_describe_enum_value(:baz), do: "A baz"
  def graphql_describe_enum_value(_), do: nil
end
```

# `graphql_description`
*optional* 

```elixir
@callback graphql_description(atom()) :: String.t() | nil
```

Used to add a custom description to GraphQL generated types (for maps, enums and unions that auto-derive).

```elixir
defmodule MyMap do
  use Ash.Type.NewType, ...

  def graphql_description(_constraints), do: "My special map"
end
```

# `graphql_input_type`
*optional* 

```elixir
@callback graphql_input_type(Ash.Type.constraints()) :: atom()
```

Sets the name of the graphql input type for a given Ash type. For example: `:weekday`.

This will do different things depending on the type you're adding it to.

## Regular Types

This expresses that you will define a custom type for representing this input in your graphql

## NewTypes
If it is a subtype of a union, or map/keyword with `fields` the type will be *created* with that name.
So you can use this to decide what it will be named. Otherwise, it behaves as stated above for
regular types.

# `graphql_rename_value`
*optional* 

```elixir
@callback graphql_rename_value(Ash.Type.constraints()) :: String.t() | atom()
```

Used for `Ash.Type.Enum` to rename individual values. For example:

```elixir
defmodule MyEnum do
  use Ash.Type.Enum, values: [:foo, :bar, :baz]

  def graphql_rename_value(:baz), do: :buz
  def graphql_rename_value(other), do: other
end
```

# `graphql_type`
*optional* 

```elixir
@callback graphql_type(Ash.Type.constraints()) :: atom()
```

Sets the name of the graphql type for a given Ash type. For example: `:weekday`.

This will do different things depending on the type you're adding it to.

## Regular Types

This expresses that you will define a custom type for representing this in your graphql

## NewTypes
If it is a subtype of a union, or map/keyword with `fields` the type will be *created* with that name.
So you can use this to decide what it will be named. Otherwise, it behaves as stated above for
regular types.

# `graphql_unnested_unions`
*optional* 

```elixir
@callback graphql_unnested_unions(Ash.Type.constraints()) :: [atom()]
```

Used for map/embedded types embedded in unions, to avoid nesting them in a key by their name.

See [the unions guide](/documentation/topics/use-unions-with-graphql.md) for more.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
