Schema

@Serializable
data class Schema(val type: String, val format: String, val description: String, val nullable: Boolean, val enum: List<String>, val properties: Map<String, Schema>, val required: List<String>, val items: Schema)

Represents the schema definition for a data model, detailing its structure, type, and various constraints.

Constructors

Link copied to clipboard
constructor(type: String, format: String, description: String, nullable: Boolean, enum: List<String>, properties: Map<String, Schema>, required: List<String>, items: Schema)

Properties

Link copied to clipboard
val description: String

A human-readable description of the schema, explaining its purpose and usage.

Link copied to clipboard
val enum: List<String>

A list of acceptable values for this schema if it represents an enumeration type.

Link copied to clipboard
val format: String

Additional formatting information for the data type, providing more precise definition (e.g., "date-time" for string type).

Link copied to clipboard

The schema for items in an array, applicable when the type is "array". Defines the schema of elements within the array.

Link copied to clipboard
val nullable: Boolean

Indicates whether the value can be null.

Link copied to clipboard
val properties: Map<String, Schema>

A map of property names to their respective schemas, defining the structure of an object type. Each entry represents a field and its schema.

Link copied to clipboard
val required: List<String>

A list of property names that are required for this schema, ensuring certain fields must be present in the data.

Link copied to clipboard
val type: String

The primary type of data this schema represents (e.g., "string", "integer", "object").