convert

Full name: taxi.stdlib.convert

Signature

declare extension function <T> convert(source: Any, targetType: lang.taxi.Type<T>): T

Description

Converts a source value to the target type using only the data already available — no service calls are made.

This is faster than a full projection (source as TargetType), but less powerful: only the fields present in the source are mapped. Missing fields are not discovered from services.

// Convert an Order to a Receipt using only the Order's own fields
find {
   receipt: Receipt = Order.convert(Receipt)
}

Examples

Converts an Order to a Receipt model using only the fields present in the source, without calling any services.

Try it out

Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed
Next
Welcome to Taxi