Data formats in Flow

Data formats specify how Flow should read and write data.

By default, Flow assumes that data is provided as JSON. However, by adding a data format to a model, this can be modified to any type of serialization format.

API specs and message formats

Some API specs which define transport also have their own message format (e.g., Protobuf). If that’s the case, you generally don’t need to do anything - Flow applies the correct formats when parsing the API spec.

API Spec Message Format Docs

Protobuf

Protobuf

Protobuf docs

OpenAPI

JSON

OpenAPI docs

SOAP

XML

SOAP docs

Avro

Avro

Avro docs

Use message formats in Taxi

If you’re using Taxi to describe your API specs, you need to specify the data format that is used for reading/writing messages.

By default, messages are expected to be in JSON. Other formats can be specified using an annotation on the top level type.

For example:

import flow.formats.Xml

@Xml
model Person {
  firstName: FirstName
}

You only need to apply the annotation to the top level entity.

Message format Annotation Links

Json

Not needed - default format

-

Xml

flow.formats.Xml

Xml annotation docs

Csv

flow.formats.Csv

Csv annotation docs

Protobuf

Not supported in Taxi - Use a Protobuf spec

Protobuf

Avro

Not supported directly in Taxi - Use an Avro spec

Avro