---
sidebar:
  hidden: true
title: roboto.experimental.ingest.schema
---
## Module Contents

### Field

```python
class roboto.experimental.ingest.schema.Field(/, **data: Any)
```

`from roboto.experimental.ingest import Field`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/experimental/ingest/schema.py#L15-L146)

Bases: `pydantic.BaseModel`

Field of a topic schema, as a caller declares it: one named value in each of the topic's messages.

Carried in `Schema.fields`. [`SchemaFieldRecord`](/docs/reference/python-sdk/roboto/domain/topics/record#roboto.domain.topics.record.SchemaFieldRecord) is the field as Roboto stores it, with the ID Roboto assigns.

`path` lists the names from the schema root down to this field, so a nested field's path extends its parent's, and its last name is `name`. Either one is derived from the other when omitted: a top-level field needs only `name`, and a nested field needs only `path`. A vector, such as a LeRobot `observation.state` feature, is one field typed [`NumberArray`](/docs/reference/python-sdk/roboto/domain/topics/record#roboto.domain.topics.record.CanonicalDataType.NumberArray), whose elements `element_names` may name.

Building it raises `pydantic.ValidationError` when:

- `data_type` is empty.
- `name` and `path` are both omitted or empty, `path` has an empty name, or the last name in `path` is not `name`.
- `element_names` is set on a field that may not carry names, or does not give each element one non-empty name that no other element has.
- The field is typed [`Timestamp`](/docs/reference/python-sdk/roboto/domain/topics/record#roboto.domain.topics.record.CanonicalDataType.Timestamp) and `unit` is `None` or not a [`TimeUnit`](/docs/reference/python-sdk/roboto/time#roboto.time.TimeUnit) value.

**Parameters**

- **data** (`Any`)

**Attributes**

- **Field.canonical_data_type** (`roboto.domain.topics.record.CanonicalDataType`): Framework-independent data type of the field, which Roboto uses to choose how to display its data.

- **Field.data_type** (`str`) = `None`: Native data type of the field, as the source data's framework names it, such as `"float32"`.

- **Field.element_names** (`list[str] | None`) = `None`: Name of each element of a fixed-length numeric array field, in element order, or `None` to leave them unnamed.

  For example, `["shoulder", "elbow"]` names the elements of a `float32[2]` joint vector.

  Only a top-level field typed [`NumberArray`](/docs/reference/python-sdk/roboto/domain/topics/record#roboto.domain.topics.record.CanonicalDataType.NumberArray) may carry names, and only when its `data_type` ends in a single `[<N>]` and its elements are not one byte wide (`uint8`, `int8`, `uint8_t`, `int8_t`, `byte`, `char` or `octet`, in any letter case). It takes one name per element, each non-empty and unique within the array, and the schema may declare no field under it. Element names are part of what identifies a schema, so the same array with and without names makes two schemas.

- **Field.model_config**: Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

- **Field.name** (`str`) = `''`: Name of the field: the last name in `path`. Defaults to that name when only `path` is given.

- **Field.path** (`list[str]`) = `None`: Names from the schema root down to this field, each non-empty, ending with `name`.

  Omitted, `None` or empty defaults to `[name]`.

- **Field.unit** (`str | None`) = `None`: Unit of the field's values, such as `"rad"`, or `None` if it has none or it is unknown.

  A field typed [`Timestamp`](/docs/reference/python-sdk/roboto/domain/topics/record#roboto.domain.topics.record.CanonicalDataType.Timestamp) must give a [`TimeUnit`](/docs/reference/python-sdk/roboto/time#roboto.time.TimeUnit) value: `"s"`, `"ms"`, `"us"` or `"ns"`.

### Schema

```python
class roboto.experimental.ingest.schema.Schema(/, **data: Any)
```

`from roboto.experimental.ingest import Schema`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/experimental/ingest/schema.py#L149-L198)

Bases: `pydantic.BaseModel`

Topic schema, as a caller declares it: the fields that make up a topic's messages.

Carried in [`topic_schema`](/docs/reference/python-sdk/roboto/experimental/ingest/operations#roboto.experimental.ingest.operations.TopicDeclaration.topic_schema). A declared schema carries no checksum: Roboto computes one from the fields and stores the schema as a [`TopicSchema`](/docs/reference/python-sdk/roboto/domain/topics/topic_schema#roboto.domain.topics.topic_schema.TopicSchema), with that checksum and the ID Roboto assigns.

Within an organization, declarations with identical fields share one stored schema, whether the fields were written by hand or converted from a source format, and in whatever order they are listed. Every attribute of every field counts: `name`, `path`, `data_type`, `canonical_data_type`, `unit` and `element_names`. Declarations that differ in any of them are stored as separate schemas. The schema's own `name` does not count.

A field a timeline source reads its timestamps from is marked only by its type, [`Timestamp`](/docs/reference/python-sdk/roboto/domain/topics/record#roboto.domain.topics.record.CanonicalDataType.Timestamp), and its [`TimeUnit`](/docs/reference/python-sdk/roboto/time#roboto.time.TimeUnit) unit. Which timeline source reads resolve to when they name none is not part of the schema: `is_default_for_reads` on each entry of [`timeline_sources`](/docs/reference/python-sdk/roboto/experimental/ingest/operations#roboto.experimental.ingest.operations.TopicDeclaration.timeline_sources) states it, and a later declaration can change it, so the same fields make one schema whichever source reads resolve to.

Building it raises `pydantic.ValidationError` when `fields` is empty, two fields have the same `path`, a field sits under a field that has `element_names`, or a field breaks a rule `Field` states.

**Parameters**

- **data** (`Any`)

**Attributes**

- **Schema.fields** (`list[Field]`) = `None`: Fields of the topic's messages, each at its own `path`.
- **Schema.model_config**: Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- **Schema.name** (`str | None`) = `None`: Informational name of the schema, such as the topic's name; not part of its identity.
