---
id: types
title: "Build types"
summary: "Create and edit the types of a flow in the type editor - fields, lists, dictionaries, nested types, enums, defaults, validation, serialization names - and how namespaces and component-generated types work."
audience: user
keywords: "types, type editor, flow types, field, list, dictionary, enum, nullable, default value, validation, serialization name, json ignore, namespace, locked type"
---
# Build types

Every record in a flow has a type. You build types in the **type editor**, import them from a sample or a schema, or
let components create them, and you export them as code for the applications a flow talks to. When the flow is
compiled, every type becomes a C# class, so scripts and mappings work with real properties.

## Open the type editor

- Click **Types** in the flow designer toolbar.
- Double-click a connection to open the editor on the connection's type.
- In a connection's properties, the **Data type** list offers the flow's types and **<...New type ...>**, which creates
  a type and opens it in the editor.

The **Flow types** editor lists the flow's types on the left. **Search** filters them, and the eye button switches
between your own types and all types, including the ones components generate. Under each type you see the types its
fields use.

## Create a type

Click **Add new type**. Then, in the header of the type:

- **Type name**: a C# identifier, unique in the flow.
- **Class or Enum**: a class has fields; an enum has named integer values.
- **Description**: shown in the editor and written into exported code.

Click **Add new field** and fill in the **Field editor**:

| Setting | What it does |
|---|---|
| **Field name** | A C# identifier, unique in the type. |
| **Property kind** | **Simple**, **List** (a list of items) or **Dictionary** (keys and values). |
| **Property type** | Text, numbers of every size, dates and times, `Guid`, `TimeSpan`, IP and MAC addresses, arrays, geometry, `Object`, or another type of the flow. Choosing another flow type nests it. Numbers, booleans, dates and times also come as **Nullable** variants. |
| **Default value** | Assigned when a record is created, converted to the field's type. |
| **Required** / **Optional** | Whether the field must have a value. |
| **Serialization name** | The name used in JSON and XML when it differs from the field name, for example `order_id` for `OrderId`. |
| **JSON ignore** | When the field is left out of JSON: **Never**, **Always**, **When default** or **When null**. |
| **Description** | Documentation for the field. |
| **Validation** | Rules checked for the value: required, number, integer, positive or negative, programmatic identifier, minimum and maximum length or value, and a regular expression. |

The field list shows each field's type and tags for required, validation, default value and serialization name.
Reorder fields with the arrows; double-click a field to edit it.

For an **enum**, each member has a name and an **Enum value** (an integer).

**Copy selected type to clipboard** copies a type together with every type it uses, so you can paste the set into
another flow. **Delete unused types** removes types nothing refers to; your own types are kept.

## Namespaces

A flow's types live in the flow's **namespace**, set in the flow properties (`viauser` by default). A type's full
name is `<namespace>.<Name>`. When you change the namespace, the flow's types and every reference to them are renamed
with it. Give flows you publish as plugins a namespace of their own.

## Types that components create

Components that know their data generate their types: a [Table reader](/documentation/plugins/database/database-reader) or
[Table writer](/documentation/plugins/database/database-writer) the row type of its table, a
[CSV decoder](/documentation/plugins/codecs/csv-decoder-plugin) the type of its columns, a [Sql query](/documentation/plugins/database/database-query)
the type of its result. Many of these are **locked**: you can view, copy and export them, but only the component
changes them, when you reconfigure it. Locked types show a lock and are hidden until you switch on all types.

## Next

- [Import types](./import) from a JSON or YAML sample, a JSON Schema or an OpenAPI document.
- [Export types](./export) as C#, Python, Go, Java, PHP, TypeScript or JSON Schema.
- [Built-in types](./built-in) you meet on plugin pins.
- [Connect an app](./connect-an-app) to a flow through a webhook.
