> For the complete documentation index, see [llms.txt](https://docs.brigge.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.brigge.ai/documentation/brigge-for-transformers/schemas.md).

# Schemas

## Introduction

A schema describes the expected structure of data for a given [system](/documentation/brigge-for-engineers/systems.md). It describes which fields are expected, where they are expected, and their associated data types.

Throughout Brigge, schemas are used wherever field selections are required. When you use a schema, field selection is much easier - the schema structure is displayed and you simply select the required field(s). For example, when [mapping nodes](/documentation/brigge-for-transformers/pipelines/pipeline-nodes/map-node.md), you start by selecting schemas for `inputs` and `outputs`. All fields in these schemas are listed so mappings can be made visually:

<div data-with-frame="true"><figure><img src="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2F9nFSfRVivrMqfnWsLdUc%2FMapping%20editor.svg?alt=media&amp;token=85820ee9-2ed5-46ae-9fab-4a6642371fb1" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
Typically, schemas are optional - if preferred you can enter dot notation paths directly.
{% endhint %}

## Working with schemas

<details>

<summary>Accessing your schemas</summary>

To view, edit, create, and manage schemas for your organisation, select `settings` ➥ `schemas` from the navigation menu. Here, you'll find all schemas listed:

<div data-with-frame="true"><figure><img src="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2FJ37Ax8MVQxkFz074C2qR%2FSchemas%20page.svg?alt=media&amp;token=b024d9c5-4a70-4d35-b3e2-233db4823516" alt=""><figcaption></figcaption></figure></div>

From here you can: click any schema name to view/edit content; search for schemas by name (or partial name); create a new schema; delete a schema.

{% hint style="info" %}
The `schemable type` reflects where the schema was created (i.e. the schema parent). For example, if a schema is created from a [system endpoint](/documentation/brigge-for-engineers/systems.md), the type is `operation`. If a schema is created from the schemas page, there is no type. The `schemable id` is an internal id correlating to the `schemable type`.
{% endhint %}

</details>

<details>

<summary>Viewing &#x26; editing schema content</summary>

Click the name of any schema to view the associated content - for example:

<div data-with-frame="true"><figure><img src="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2FLKGaJGjGRkTrQvlsJBbC%2FSchema%20edit%20with%20elements.svg?alt=media&amp;token=7e8b1c52-e05f-4dd3-b3e8-36280e376549" alt=""><figcaption></figcaption></figure></div>

Key items are summarised below:

{% stepper %}
{% step %}
**Renaming a schema**

If you update the schema name and save changes, the change takes effect wherever the schema is currently used.
{% endstep %}

{% step %}
**Searching for schema elements**

Enter the name (or partial name) of a schema element that you want to find. Any matched items are highlighted (if needed, you can use `prev` / `next` buttons to step through each one in turn). For example:

<div align="left" data-with-frame="true"><figure><img src="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2FHbNvXvpUNmQWwPU6dp1w%2Fsearch%20for%20schema%20element.png?alt=media&amp;token=c7720d39-8847-4312-be07-afd38ffe92b8" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Toggle schema view**

By default, the selected schema is displayed in form view. For advanced editing, use the toggle option and switch to raw view. For example:&#x20;

<div align="left" data-with-frame="true"><figure><img src="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2FXucysbxx5GcOqZhPk8oY%2Fschema%20toggle.png?alt=media&amp;token=74f5f154-3b9b-4f0d-877e-7883456d98c6" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Element details & options**

In form view, elements are listed so you can see the element name and data type, at a glance. Hover your cursor over any element for [update options](#updating-a-schema):

<div align="left" data-with-frame="true"><figure><img src="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2Fr1fpLfY1uSLGlLENuqbN%2Fschema%20element%20update%20options.png?alt=media&amp;token=28d28ac1-12d5-435e-85b5-cd22cfede62d" alt=""><figcaption></figcaption></figure></div>
{% endstep %}
{% endstepper %}

</details>

<details>

<summary>Creating a schema</summary>

You can create schemas in different places throughout Brigge. For example:

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td>From the <em>Schemas</em> page.</td><td data-object-fit="contain"><a href="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2FML5YR41i4k2dO6kzoKXM%2Fcreate%20schema%20-%20schemas%204.png?alt=media&amp;token=1b9131e5-da83-4466-9996-c9f047ded12b">create schema - schemas 4.png</a></td></tr><tr><td>From the <a href="/documentation/brigge-for-transformers/pipelines/pipeline-nodes/map-node.md">mapping editor</a>.</td><td data-object-fit="contain"><a href="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2Favfu7dyMskQIdPtVZboj%2Fcreate%20schema%20-%20map.png?alt=media&amp;token=6cd63ce4-d75e-496d-a6e3-494b6a369a50">create schema - map.png</a></td></tr><tr><td>From an output payload in <a href="/documentation/brigge-for-operators/history-and-retries.md#payloads-all-payloads-processed-in-this-run">pipeline logs</a>:</td><td data-object-fit="contain"><a href="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2FCniej3TA5z6f6TorZNin%2Fcreate%20schema%20-%20logs.png?alt=media&amp;token=474e1424-ff47-471b-8192-a3017be08ecd">create schema - logs.png</a></td></tr><tr><td>From a <a href="/documentation/brigge-for-engineers/systems.md">system endpoint</a>:</td><td data-object-fit="contain"><a href="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2FBfLuQRVn23hGgfGzW2d1%2Fcreate%20schema%20-%20endpoint.png?alt=media&amp;token=efbde97b-8569-4949-8c50-5201137f612a">create schema - endpoint.png</a></td></tr></tbody></table>

Irrespective of where you choose to create a schema, the same setup principles apply: enter a name for the schema, paste schema content into the editor, then click the `next` button:

<div data-with-frame="true"><figure><img src="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2FkAco6RvHzv0Jpt37o88V%2FCreate%20schema%201.svg?alt=media&amp;token=6ac731d5-3ae0-409c-bbd3-2ed3190bef36" alt=""><figcaption></figcaption></figure></div>

Your schema content might be an 'official' schema (for example, one that you've copied and pasted from elsewhere) or you can paste a sample output from your system.

{% hint style="info" %}
If you're working with a pipeline and need to create a schema 'on the fly': access the logs, find an output payload, then use the `create schema` option.
{% endhint %}

{% hint style="info" %}
Schemas can be as simple or as complex as you need. With advanced knowledge, you can create nested schemas, link to external schemas, etc. If this is something you'd like to explore, the following website may be useful: <https://json-schema.org/specification>.
{% endhint %}

After pasting your content and confirming with the `next` button, the schema is displayed in form view. Click the `save` button to confirm settings and make this schema available for use throughout Brigge.

</details>

<details>

<summary>Updating a schema</summary>

When viewing a schema in form view, hover your cursor over any element for update options:

<div align="left" data-with-frame="true"><figure><img src="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2Fit0bWQQrZqLNhh7D5Sdm%2FUpdate%20schema%20elements.svg?alt=media&amp;token=87ba1935-d0e7-4317-a54d-b9d2158deae5" alt=""><figcaption></figcaption></figure></div>

These options are summarised below:

{% stepper %}
{% step %}
**Add array element**

Click the `plus` icon to add a new element to an array object (only applicable if an array is selected). When prompted, choose a data type for this element:

<div align="left" data-with-frame="true"><figure><img src="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2Fr8Z8sAoN0TzZSDMfk6zV%2Fadd%20array%20item%201a.png?alt=media&amp;token=28a57d82-87c7-44cc-b3bb-003b54bab6e8" alt=""><figcaption></figcaption></figure></div>

Then enter details for this element. For example:

<div align="left" data-with-frame="true"><figure><img src="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2FsVrV3cSOGGLSfryhPXkl%2Fadd%20array%20item%202a1.png?alt=media&amp;token=aab35876-7c23-4b53-9859-0d7700be7858" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
Element details vary, depending on the selected data type.
{% endhint %}
{% endstep %}

{% step %}
**Edit element**

Click the `pencil` icon to edit an existing element (of any type) to view and update details. For example:

<div align="left" data-with-frame="true"><figure><img src="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2FyXo8wRFxEDxNmS3GebLM%2Fedit%20element.png?alt=media&amp;token=ba46e76e-f0c2-4d5e-a3f7-d6314cda939a" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
Element details vary, depending on the selected data type.
{% endhint %}
{% endstep %}

{% step %}
**Delete element**

Click the `trash` icon to remove an existing element. The item is removed immediately.
{% endstep %}
{% endstepper %}

</details>

<details>

<summary>Deleting a schema</summary>

To delete a schema that's no longer in use, click the associated `delete` button from the [schema list](#accessing-your-schemas). For example:

<div data-with-frame="true"><figure><img src="https://2172380191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8IqdqwZowcxtFpZfLa6k%2Fuploads%2FB0ZxMx5E3Wcisg25snjT%2Fdelete%20schema%201.png?alt=media&amp;token=e5e6fa60-2323-4e82-abe4-75a64790c14e" alt=""><figcaption></figcaption></figure></div>

{% hint style="danger" %}
A schema cannot be restored if deleted.
{% endhint %}

{% hint style="info" %}
You can't delete a schema if it's currently configured in pipelines.&#x20;

In this scenario, you'll see a warning that lists relevant pipelines. You should remove the schema from any nodes where it's used in these pipelines and then try the `delete` action again.
{% endhint %}

</details>
