Mapping

Mapping turns an API's raw response into clean columns that your components can display. You set it at the connector's Model step, on a graph.

Entities and DTOs

The DTO describes the data as the API sends it, with its types: Text, Number, Integer, Boolean, Object, Array.
The entity describes the data as Kubme uses it, with its columns: Text, Numeric, Date, Date & time, Boolean, List, Identifier, Object, Collection.
The mapping links each entity column to a DTO field.

One connector can have several entities linked together (a customer has orders): these are relations.

Already done for you

After an OpenAPI import, the DTOs, entities and mapping are generated. Often, all that is left is fine-tuning.

Working on the graph

The graph's toolbar offers Fit view, Auto Layout, Filter (show only what concerns some actions) and Add Model (new entity, empty DTO…).

Right-click a node:

On a column: New column, Set as identifier, Edit path, Delete column.

A DTO's path

Data is often not at the root of the response, but for example in data.items. Configure path opens "Where is…?": add one step per level (Add a step, Property name, then List or Object). Leave it empty if the response is already the object.

Paths use simple JSONPath notation: $, names, indexes and [*].

A paginated response

The API returns { "data": { "items": [ … ], "total": 120 } }: add the step data (Object), then items (List). Each element of items becomes a row.

Transformation blocks

In an entity's mapping view, Add block inserts a transformation between the API and the column:

Try it then Run tests a block on a sample value. Blocks that cannot be reversed are read-only: the column is not written back to the API.

Types and empty values

A value that does not match its column's type (text in a Numeric column) causes the error "A value does not match its column's type". An empty string is read as a missing value, except in a Text column.

To check the result, run the action at the Preview step (see Actions).

Made with