Nullability
- Last UpdatedSep 04, 2025
- 1 minute read
You can define properties of type messages to accept null values. The nullability of a property is determined by the following rules:
-
For static types, only String properties are nullable.
-
For dynamic types, all property types are nullable.
-
For dynamic types, a null value is translated to .
-
Properties that use IsIndex or IsName are not nullable.
You define a property as nullable by specifying an array of accepted values including the type and null. The type and null may appear in any order in the array. The following is an example of a property that is not nullable:
"properties": [
"Address": {
"type": "string"
}
]
Here is the same property defined as nullable:
"properties": [
"Address": {
"type": [ "string", "null" ]
}
]
Note: The default value for a String property that is not nullable is . This is in contrast to the default value for String properties defined in the OMF specification, which is .
The following are additional examples of properties defined as nullable:
"properties": [
"Widgetness": {
"type": [ "number", "null" ],
"format": "float32"
}
"Widgetness": {
"type": [ "null", "integer" ],
"format": "int32"
}
]