PropertyBuilder

Builder for defining property types and constraints.

This builder provides methods to specify the type of a property (string, number, boolean, array, object, etc.) along with its constraints. Use the required flag to mark properties as required in the schema.

Supported Property Types

  • string - String properties with format, pattern, length constraints

  • integer - Integer numeric properties

  • number - Numeric properties (including decimals)

  • boolean - Boolean properties

  • array - Array properties with item type definitions

  • obj - Nested object properties

  • reference - Schema references ($ref)

Example

property("status") {
required = true
string {
description = "Current status"
enum = listOf("active", "inactive", "pending")
}
}

See also

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Marks this property as required in the parent schema.

Functions

Link copied to clipboard

Creates an array property definition.

Link copied to clipboard

Creates a boolean property definition.

Link copied to clipboard

Creates an integer property definition.

Link copied to clipboard

Creates a numeric property definition (supports decimals).

Link copied to clipboard

Creates a nested object property definition.

Link copied to clipboard

Creates a reference to another schema definition.

Link copied to clipboard

Creates a string property definition.