Defining default values

When you define the properties of a data type, you can assign a default value. This value is automatically applied when the definition file is imported.

Default values are supported during schema import and are included in the generated JSON Schema and OpenAPI documentation. For more information, see Swagger UI for decision runtime API and the execution Java API reference manual in the Reference section.

Syntax

You specify default values inside the properties element by using the default key, as shown in the following example:

"properties": {
  "field string": {
    "type": "string",
    "default": "str"
  },
  "field number": {
    "type": "number",
    "default": 12.2
  },
  "field float": {
    "type": "number",
    "format": "float",
    "default": 12.2
  }

}

Supported types

Default values are supported for all built-in data types and enumeration types.

For composite types, only empty objects ({}) are supported. In Java, the resulting field contains an object initialized by its default constructor.