# `Ash.Info.Manifest.Resource`
[🔗](https://github.com/ash-project/ash/blob/v3.25.2/lib/ash/info/manifest/resource.ex#L5)

Represents a resource in the API specification.

Resources are pure type/shape definitions. Fields and relationships are
stored as maps keyed by atom name for O(1) lookup. Actions live separately
in `%Ash.Info.Manifest{}.entrypoints`.

# `t`

```elixir
@type t() :: %Ash.Info.Manifest.Resource{
  custom: map(),
  description: String.t() | nil,
  embedded?: boolean(),
  fields: %{required(atom()) =&gt; Ash.Info.Manifest.Field.t()},
  identities: %{required(atom()) =&gt; %{keys: [atom()]}},
  module: atom(),
  multitenancy:
    %{strategy: atom(), global?: boolean(), attribute: atom()} | nil,
  name: String.t(),
  primary_key: [atom()],
  relationships: %{required(atom()) =&gt; Ash.Info.Manifest.Relationship.t()}
}
```

# `accessible_relationships`

```elixir
@spec accessible_relationships(t(), [atom()] | MapSet.t()) :: [
  Ash.Info.Manifest.Relationship.t()
]
```

Returns relationships whose destination is in the allowed list, sorted by name.

# `all_fields`

```elixir
@spec all_fields(t()) :: [Ash.Info.Manifest.Field.t()]
```

Returns all fields as a list, sorted by name.

Sorting ensures codegen output is deterministic across runs (Erlang map
iteration order is unstable for maps with more than 32 keys).

# `all_relationships`

```elixir
@spec all_relationships(t()) :: [Ash.Info.Manifest.Relationship.t()]
```

Returns all relationships as a list, sorted by name.

# `field_names`

```elixir
@spec field_names(t()) :: [atom()]
```

Returns all field names (attributes, calculations, aggregates), sorted.

# `fields_by_kind`

```elixir
@spec fields_by_kind(t(), Ash.Info.Manifest.Field.kind()) :: [
  Ash.Info.Manifest.Field.t()
]
```

Returns all fields of a given kind (:attribute, :calculation, or :aggregate), sorted by name.

# `get_field`

```elixir
@spec get_field(t(), atom()) :: Ash.Info.Manifest.Field.t() | nil
```

Gets a field (attribute, calculation, or aggregate) by name.

# `get_identity`

```elixir
@spec get_identity(t(), atom()) :: %{keys: [atom()]} | nil
```

Gets an identity by name.

# `get_relationship`

```elixir
@spec get_relationship(t(), atom()) :: Ash.Info.Manifest.Relationship.t() | nil
```

Gets a relationship by name.

# `has_field?`

```elixir
@spec has_field?(t(), atom()) :: boolean()
```

Checks if a field or relationship exists by name.

# `relationship_names`

```elixir
@spec relationship_names(t()) :: [atom()]
```

Returns all relationship names, sorted.

---

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