> ## Documentation Index
> Fetch the complete documentation index at: https://fastql.vachagan.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Decorators and metadata

> Reference for schema decorators, Field, Arg, and directives.

## Class decorators

`Type`, `Input`, `Interface`, `Query`, `Mutation`, and `Subscription` accept a class
directly or can be called with metadata. Their shared options include GraphQL name,
description, directives, and explicit field configuration where applicable.

```python theme={null}
@Type
class User: ...


@Type(name="Account", description="A billable account.")
class AccountModel: ...
```

`Enum`, `Union`, and `Scalar` use definitions appropriate to their GraphQL kind but
register into the same type registry and compile into the same schema model.

## Field

`Field` works as an annotated attribute descriptor, method decorator, or callable
resolver declaration. Supported metadata includes:

* `name`, `description`, `deprecated` or `deprecation_reason`
* `type` or `type_` for explicit GraphQL type control
* `default` or `default_factory`
* `arguments`, `directives`, `extensions`, and `permission_classes`

## Arguments

Use `Arg(...)` as a parameter default or `Argument(...)` with `typing.Annotated`.
Argument metadata supports names, descriptions, deprecation, defaults, and directives.

```python theme={null}
from typing import Annotated

from fastql import Argument, Field


@Field
def user(self, id: Annotated[str, Argument(description="User identifier")]) -> User:
    ...
```

## Custom directives

`@Directive` registers a directive definition whose arguments come from the class's
type hints. Apply it with `AppliedDirective`, validated at build time. See
[Custom directives & visibility](/build/directives-and-visibility).

```python theme={null}
from fastql import Directive, Type
from fastql.types import AppliedDirective


@Directive(locations=["FIELD_DEFINITION", "OBJECT"], repeatable=False)
class tag:
    name: str


@Type(directives=[AppliedDirective("tag", {"name": "obj"})])
class Widget: ...
```

## Field visibility

`Field(private=True)` keeps a Python attribute off the schema (still readable by
resolvers); `Field(external=True)` marks a field as federation-`@external`.

## Enum customization

`enum_value(...)` overrides a member's GraphQL `name`, `description`, or
`deprecation_reason`.

```python theme={null}
from fastql import Enum, enum_value


@Enum
class Color:
    RED = "red"
    BLUE = enum_value("blue", name="AZURE", description="cool")
```
