ArrayPropertyBuilder

Builder for ArrayPropertyDefinition.

Configures array-type properties with item type definitions and size constraints. Provides convenient methods for specifying item types using ofString(), ofObject(), etc. Supports automatic conversion of List values to JsonArray.

This class is part of the JSON Schema DSL and cannot be instantiated directly. Use PropertyBuilder.array instead within the DSL context.

Array of Strings

property("tags") {
array {
description = "List of tags"
minItems = 1
maxItems = 10
ofString()
}
}

Array of Objects

property("steps") {
array {
description = "Processing steps"
ofObject {
additionalProperties = false
property("explanation") {
required = true
string {
description = "Step explanation"
}
}
property("output") {
required = true
string {
description = "Step output"
}
}
}
}
}

See also

Properties

Link copied to clipboard
var default: Any?

Default value for this property.

Link copied to clipboard

Human-readable description of this property.

Link copied to clipboard

Maximum number of items in the array.

Link copied to clipboard

Minimum number of items in the array.

Link copied to clipboard

Whether null values are allowed.

Link copied to clipboard

The JSON Schema type. Always "array" for this builder.

Functions

Link copied to clipboard
Link copied to clipboard

Defines the type of items in the array using a generic property builder. Consider using the of*() convenience methods instead.

Link copied to clipboard
fun ofArray(block: ArrayPropertyBuilder.() -> Unit = {})

Specifies that array items are arrays (nested arrays).

Link copied to clipboard
fun ofBoolean(block: BooleanPropertyBuilder.() -> Unit = {})

Specifies that array items are booleans.

Link copied to clipboard
fun ofInteger(block: NumericPropertyBuilder.() -> Unit = {})

Specifies that array items are integers.

Link copied to clipboard
fun ofNumber(block: NumericPropertyBuilder.() -> Unit = {})

Specifies that array items are numbers (supports decimals).

Link copied to clipboard
fun ofObject(block: ObjectPropertyBuilder.() -> Unit = {})

Specifies that array items are objects.

Link copied to clipboard

Specifies that array items reference another schema definition.

Link copied to clipboard
fun ofString(block: StringPropertyBuilder.() -> Unit = {})

Specifies that array items are strings.