Just a second...

RecordV2 schema

A schema is an optional way to define how data is formatted when it is published on a recordV2 topic. A schema defines and names the permitted records and fields within the topic, and enables direct access to the fields.

The recordV2 topic type contains data organized into records and fields. You can optionally provide a schema which defines the expected structure of the data.

RecordV2 structure

The recordV2 topic type has a value consisting of records, which contain fields. Each recordV2 topic can contain one or more records. Each record can contain one or many fields.

Content contains one or more records. Records contain one or more fields.

Using a schema

With a schema, you can define how the records and fields within a recordV2 topic are laid out.

Fields and records within a schema are identified by a name. Every record must have a name that is unique within the content. Every field must have a name that is unique within the enclosing record.

Every field or record defined in the schema can represent one or more possible occurrences of that field or record in the data. The number of possible occurrences of a record or field is described by its multiplicity.

The order in which records and fields are defined within the schema sets the order that they appear within the topic.

Records

A record can contain one or more fields.

Every record has multiplicity.

Fields

A field defines an elementary data item within a record.

Every field has the following properties:

Multiplicity

The multiplicity of a field or record in a schema defines the number of times it can occur in the topic. Multiplicity is set by providing a minimum value and a maximum value.

Fixed multiplicity means the minimum and maximum are the same. For example, if a field has a minimum of 5 and a maximum of 5, there must be exactly five occurrences of the field within its enclosing record.

Variable multiplicity means the minimum and maximum are different. For example, a schema could specify that there must be between one and five occurrences of a field within its enclosing record. Variable multiplicity is only allowed in the last record in a topic, or the last field in a record.

Use a minimum value of 0 to define an optional field/record. A fixed multiplicity of 0 is not allowed.

A maximum value of -1 is used to represent that there is no limit to how many times the field or record can occur.

Data type

The data type of a field defines the type of values it can contain. The following table describes the data types that are available.
Table 1. Data types for schema fields
Data type Description
String

A character string.

Integer

An integer represented in the content as a character string.

If a field is defined as this type, it can only contain numeric digits with an optional leading sign. Fields of this type cannot be empty.

Decimal

A decimal number represented in the content as a character string.

Decimal fields have the number of places to the right of the decimal point defined by the scale. Such values can be parsed from a character string with any number of digits to the right of the decimal point. Half-up rounding is applied to achieve the target scale. Output of the field is rendered with the specified scale. Fields of this type cannot be empty.

For comparison purposes the scale is ignored: a value of 1.50 is the same as 1.5.

Defining a schema

See Defining a recordV2 schema for details of how to define a schema and apply it to a recordV2 topic.