Skip to content

Data types

A data type describes a typed shape of runtime data — a geometry, a mesh, a result table, a length value, a CAD model. Data types are the platform's type system: a single, composable vocabulary of types, each defined once as its own component and reused wherever typed data or typed structure is needed.

The roles of a data type

A data type plays one or more roles, declared as a set in its metadata:

metadata {
    reference = "group:id:version"
    name = "…"
    description = "…"
    roles = setOf(SCHEMA)   // DATA is the default
}
  • DATA — typing data in workflows. Instances of the data type are data: they flow through the inputs and outputs of methods and workflow types and live in the data repository. This is the default: a data type that declares no roles types workflow data, and the build generates a data model builder for it, so instances can be constructed assignment-style in tests and tooling. A data type can play this role with or without a structural schema.

  • SCHEMA — building block for other schemas. A data type that declares a data schema can be embedded as a field type in any other schema — a method or workflow type configuration schema, another data type's data schema, or a metadata schema. See Embedding data types in other schemas. Every data type with a schema can be embedded; declaring SCHEMA alone says the type is a reusable fragment that is only ever embedded, so nothing more is generated for it than its schema injection functions.

  • MATERIAL — material schema. Materials declare the data type as their schema and their properties conform to its data schema. The build generates the material declarators and the data model builder for it, and the component registry accepts only data types with this role as material schemas. See Materials.

The roles combine freely: a data type can be data and a schema fragment at the same time, and a material schema is often also embedded as a fragment in a material-independent configuration. Roles are searchable: simkit component search --data-type-role MATERIAL <query> lists the material schemas matching a query.

The roles mirror the platform's layering. Data is what a workflow processes — the primary subject flowing through the dataflow graph. Configuration is how that data is processed — a second layer, declared per component. Both layers describe typed structure, so both draw on the same type system rather than each maintaining its own.

Keeping one composable type system separate from its use cases is a deliberate design decision. The alternative — a dedicated component kind per schema-shaped concern, e.g. a "schema component" for reusable configuration fragments next to data types for runtime data — would multiply component kinds that all behave the same way. One kind with one rule ("embedding requires a schema") keeps the model small, at the cost of that rule. And it pays off in workflow definitions: a single generated value-model class backs a data type everywhere it appears, so a piece of data can be mapped into a downstream configuration field of the same type — conveniently, and type-checked at build time (see below).

Anatomy of a .data-type.kts

dataType {
    dependencies {
        // dataType("group:id:1.0.0-SNAPSHOT-latest")            // latest snapshot
        // dataType("group:id:1.0.0-SNAPSHOT-2026-05-15-1")      // a pinned snapshot
    }

    metadata {
        reference = "group:id:version"
        name = "…"
        description = "…"
    }

    dataSchema {
        // schema fields describing instances of this data type
    }

    // Optional:
    // metadataSchema { … }
    // uiSchema { … }
    // dataSchemaValidationRuleSet { /* return a ValidationRuleSet */ }
    // metadataSchemaValidationRuleSet { /* return a ValidationRuleSet */ }
    // migrationRoutes { from("1.0.0") }
    // migrationRuleSet { /* return a MigrationRuleSet */ }
}

Required: dependencies (can be empty), metadata, dataSchema (can be empty — that declares an opaque data type). The two migration blocks declare how data uploaded under older versions migrates to this one — see Migration.

Data schema vs metadata schema

Two parallel schemas can be declared:

  • dataSchema { } — the structural shape of the data instance itself. For a mesh, this might be a list of cells with positions and sizes. For a length, a single dimensional scalar. This is the primary schema; the platform tracks each instance per this schema.
  • metadataSchema { } — optional descriptive metadata attached to a data instance. For a mesh, the cell count or bounding box; for a length, nothing typically. The metadata travels with the instance and is queryable separately.

Each schema can have a sibling validation rule set: - dataSchemaValidationRuleSet { ... } validates the data itself. - metadataSchemaValidationRuleSet { ... } validates the metadata.

See validation-rules.md for the rule-set shape.

Choosing the next version

The version number of a data type is a promise to everyone who holds an instance of it. The recommended rule is driven by the two schemas and their validation rule sets, not by the size of the change:

Bump When
patch no schema change
minor a schema change that every existing instance survives
major a schema change that may break an existing instance

"Schema" means dataSchema, metadataSchema and their validation rule sets. The component metadata (name, description, icon, release notes) and the uiSchema are not part of it — changing them is a patch.

A change is non-breaking when every already-stored instance still validates against the new schema after default population:

  • a new field with a default
  • a relaxed validation rule
  • a newly accepted file format

A change is breaking when an existing instance may fail validation or be read with a different meaning:

  • a removed, renamed or retyped field
  • a new field without a default, which is therefore mandatory
  • a tightened validation rule, even when the old rule was too lenient
  • a changed unit or meaning of an existing field
  • any dataSchema change of an opaque data type, because the platform cannot rewrite the content

The last two items in the breaking list are the ones the registry cannot detect: a schema that merely adds a field is still a major when the meaning of the data changes.

The bump decides how existing data reaches the new version: within one major, data migrates implicitly; a new major must declare a migration route and rule from the latest released version — see Migration.

See components-and-versions.md for the registry's sequencing rules.

The schema description language

The DSL inside dataSchema { } and metadataSchema { } is the same schema description language used in method / workflow type configuration schemas. Atomic types, enums, compounds, lists, dimensional scalars/vectors, entity assignments, plus list-of-anything. See schema-language.md for the full surface.

A small example — a mock-mesh data type:

dataType {
    dependencies { }

    metadata {
        reference = "simscale.test:mock-mesh:1.0.1"
        name = "Mock mesh"
        description = "List of cells, each shaped as a box."
    }

    dataSchema {
        compoundList("meshCells") {
            label("Cells")

            dimensionalVector("position", metricUnits = UnitProfile(BaseSIUnits.METER)) {
                label("Position")
            }

            dimensionalVector("size", metricUnits = UnitProfile(BaseSIUnits.METER)) {
                label("Size")
            }
        }
    }

    metadataSchema {
        integer("cellCount") {
            label("Cell count")
            doc("Number of cells in the mesh")
        }
    }
}

Opaque data types: an empty data schema

dataSchema {} — empty — is a legitimate and common shape. It declares an opaque data type: the platform stores and moves instances of it without modeling their internal structure. Proprietary file formats work this way — a CAD model or a mesh file has rich structure, but that structure lives in the tools that read and write the format, not in the platform's schema system. (Real mesh data types are opaque for exactly this reason; the mock-mesh above is deliberately structured so the example workflows can exercise structured data.)

Opaque data types usually declare upload/download capability and their accepted file formats in metadata { } instead:

dataType {
    dependencies { }

    metadata {
        reference = "simscale.test:mock-file:1.0.0"
        name = "Mock file"
        description = "An opaque uploadable/downloadable file."

        uploadable = true
        downloadable = true

        fileFormatGroup("Files") {
            fileFormat("Text file") { fileExtensions = listOf("txt") }
        }
    }

    dataSchema {}
}

(uploadable, downloadable, and fileFormatGroup are independent of the schema — a structured data type can declare them too.)

An opaque data type participates fully in the DATA role: it types data-interface entries, its instances are uploaded, produced, and consumed by workflows, and it can still carry a metadataSchema { } with validation rules over the metadata. What it cannot do is the SCHEMA role — there is no schema to embed in other schemas.

Embedding data types in other schemas

When a component declares a data-type dependency, the build generates a schema injection function for it — named camelCase from the component id — plus a *List companion. Calling it inside a schema block embeds the data type's data schema as a field. Data types shaped as reusable configuration fragments are the typical subject — here, an output-item descriptor shared by several methods:

dependencies {
    dataType("simscale.test:native-test-method-output-item:1.0.0")
}

configurationSchema {
    nativeTestMethodOutputItem("solverLog") {
        label("Solver log")
    }
    nativeTestMethodOutputItemList("resultPlots")
}

This works anywhere a schema is authored:

Host schema Component kind
configurationSchema { } Method
configurationSchema { } Workflow type
dataSchema { } Another data type
metadataSchema { } Another data type

and at any depth — inside compound { } bodies, inside lists, and inside data types that are themselves embedded elsewhere.

Two rules apply:

  • The embedded data type must be declared in dependencies { }. The schema stores the embedded reference version-less (group:id); the version is pinned through the dependency declaration. An embedded reference with no matching dependency is rejected at build and at registration.
  • The embedded data type must have a data schema. Embedding an opaque data type is not useful: the resulting field is an empty record with nothing to configure or validate.

The embedding site controls the field itself: the field name is the function argument, and label, doc, and optional set in the body take precedence over what the data type declares.

Inline data types

A data type can declare its schema with dataSchema(inline = true), which requires exactly one field. Embedding such a data type yields that field directly instead of a one-field record. The per-quantity dimensional types work this way: the length data type's schema is a single inlined dimensional scalar, so length("edgeLength") in your configuration schema — the shortcut described in measurement-units-and-dimensionals.md — is exactly the length data type's schema injection function.

One value model everywhere: type-safe reuse

The build generates one value-model class per data type (e.g. MockMeshValueModel), and that same class is used wherever the type appears:

  • A configuration field embedding the data type is typed with it.
  • A workflow's data-interface entry of that data type yields a data reference whose value property exposes the instance content as the same class (and metadata exposes the metadata-schema view, when one is declared).

So inside a workflow definition, data and configuration of the same data type are interchangeable where a value of that type is expected, and any mismatch is a compile error at build time — not a runtime surprise. For example, mapping workflow configuration into a method configuration field of the same data type:

nativeTest(solverLog = solverLog) {
    solverLog = configValueModel.solverLogConfig
    // both sides: NativeTestMethodOutputItemValueModel
}

or reading a data instance's content in an inline operation or a condition:

operationGroupWithCondition("refine", condition = mesh.present and (mesh.value.meshCells.size() lessThan 3000)) {
    // …
}

Everything the build generates for a data-type dependency

  • The schema injection function and its *List companion (nativeTestMethodOutputItem(name) { … }, nativeTestMethodOutputItemList(name) { … }) — for embedding, as above.
  • For inline dimensional data types: literal extensions on Kotlin numbers (Number.millimeter, Number.meter, …), usable anywhere a DimensionalScalar is expected.
  • The value-model class (MockMeshValueModel), with fromDefaults { … } for building instances in inline operations and method outputs.

The naming convention is camelCase from the kebab-case id. The functions appear unqualified in the consumer's .kts because the build pipeline injects import <group>.* before compilation.

UI schema

uiSchema { } is an optional block describing how instances render in SimScale Workbench / SimKit Web UI. Authors of basic data types typically don't need it; complex data types (geometries, results visualizations) do. Coverage is in reference: schema DSL.

Where data type instances live

The data type itself is a component (registered to the component registry); instances of it are created when workflows produce them and read when workflows consume them.

A component developer's surface is the data type. Instance lifecycle is the platform's concern.

Cross-references