# relations.json

What links between entities mean.

## `relations`

array of objects

A link from entities of one type to entities of another, such as `brand` from `product` to `brand`.

- `code` (string · required): The code of a relation definition, such as `brand` or `compatible_with`.

- `from` (string · required): The code of an entity type, such as `product`, `category` or a merchant's own `store`.

- `to` (string · required): The code of an entity type, such as `product`, `category` or a merchant's own `store`.

- `label` (string or map of strings): A plain value, or a map from locale to value such as \{ "de": "Farbe", "en": "Color" \}.

- `input` (string): How links arrive: inline on the entity, or as a stream of their own. Default: `inline`.
  
  - `inline`: How links arrive: inline on the entity, or as a stream of their own. Default: `inline`.
  
  - `stream`: How links arrive: inline on the entity, or as a stream of their own. Default: `inline`.

- `qualifiers` (array of objects): Notes that belong to one link, such as "only with sport suspension". Shown and traced, never filtered silently.
  
  A note a single link may carry.
  
  - `code` (string · required): The code of a relation definition, such as `brand` or `compatible_with`.
  
  - `label` (string or map of strings): A plain value, or a map from locale to value such as \{ "de": "Farbe", "en": "Color" \}.

- `create_missing` (boolean): A link to a target that does not exist creates it, as a feed's brand name creates its brand.

- `aliases` (map of strings): Spellings OrbSearch maps onto a target's id, such as `"Robert Bosch GmbH": "bosch"`. They survive every feed.

- `search_target_title` (boolean): Whether the target's title becomes searchable text of the source. Forty printer names may; a thousand vehicle names may not. Default: `false`.

## `$schema`

string

The JSON Schema an editor checks this file against; kept as written.

## Example

```json title="tests/fixtures/home/relations.json (trimmed)"
{
  "$schema": "../../../contracts/schema/relations.json",
  "relations": [
    {
      "code": "brand",
      "from": "product",
      "to": "brand",
      "label": { "de": "Marke", "en": "Brand" },
      "create_missing": true,
      "search_target_title": true
    }
  ]
}
```

**Guide:** [The release files](/docs/releases#the-release-files)
