# Dictionaries

Sometimes you need to choose from a predefined list of values already existing in the system.

In the configuration, it's not always easy as the values may be related to the configuration itself. The values may be available only after configuring the API Key in step one etc, therefore, cannot be part of the regular schema.

That's where the dictionaries come in handy. There are two sources of the configuration. The data either come from Ergonode or App.

The source of the dictionary is recognized via prefixes `ergonode:` and `app:`

## Ergonode

List of available dictionaries

* ergonode:attributes
  * it is possible to limit types of attributes thanks to query parameters - `egonode:attributes?type=TEXT,TEXT_AREA`
* ergonode:categories
* ergonode:languages
* ergonode:media\_profiles

## App

In App, you can define as many custom dictionaries as you require.

In Manifest [configuration\_schema](https://docs.ergonode.com/apps2/detailed-reference/manifest/configuration-schema) you reference the dictionary by the conjunction of `app:` prefix and dictionary ID suffix i.e `app:attributes`.

App provides custom dictionaries by implementing `/dictionary/{dictionary}` endpoint.

For the above example, the endpoint would be `/dictionary/attributes`.

{% hint style="info" %}
The dictionary endpoint will be called only when the step of the configuration schema it is defined in is generated, so you have all the configuration from earlier steps at your disposal during dictionary retrieval(like API keys, etc).
{% endhint %}

The endpoint response for the valid dictionary should return

```json
{
  "dictionary": [
    {
      "id": "value",
      "label": "Presentation label"
    }
  ]
}
```

#### Type validation

If your mapping requires extra type validation, you may provide `type`  for every entry that matches the mapping context. For multiple types, separate them with `|`.

```json
{
  "dictionary": [
    {
      "id": "description",
      "label": "Description attribute",
      "type": "TEXT_AREA|TEXT"
    }
  ]
}
```

#### Merging values

By default, mapping on dictionary items allows only one value to be mapped to a specific attribute. It is possible to override this behavior by declaring the possibility of merging via `allows_merging` flag.

If enabled, the App is responsible for merging value itself according to internal strategy - flag only changes the behavior of the mapper, and values are provided to App the same way.

```json
{
  "dictionary": [
    {
      "id": "description",
      "label": "Description attribute",
      "allows_merging": true
    }
  ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ergonode.com/apps2/detailed-reference/manifest/dictionaries.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
