ValuePropertyDefinition

Represents a value-based property definition in a JSON Schema.

This is a sealed interface that extends from PropertyDefinition and serves as the base for properties that define specific types, such as strings, numbers, arrays, objects, and booleans. Each implementation of this interface allows defining additional type-specific constraints and attributes.

Parameters

T

The native Kotlin type that this property definition represents (e.g., String, Double, Boolean). The type parameter enables type-safe accessors for default and const values while maintaining JSON Schema 2020-12 spec compliance by storing values as JsonElement during serialization.

Inheritors

Properties

Link copied to clipboard
abstract val allOf: List<PropertyDefinition>?
Link copied to clipboard
@SerialName(value = "$anchor")
abstract val anchor: String?
Link copied to clipboard
abstract val anyOf: List<PropertyDefinition>?
Link copied to clipboard
@SerialName(value = "$comment")
abstract val comment: String?
Link copied to clipboard
@SerialName(value = "const")
abstract override val constValue: JsonElement?

Const value as JsonElement (spec-compliant storage). Can be any JSON value per JSON Schema 2020-12 spec.

Link copied to clipboard
abstract override val default: JsonElement?

Default value as JsonElement (spec-compliant storage). Can be any JSON value per JSON Schema 2020-12 spec.

Link copied to clipboard
@SerialName(value = "$defs")
abstract val defs: Map<String, PropertyDefinition>?
Link copied to clipboard
abstract val deprecated: Boolean?
Link copied to clipboard
abstract val description: String?
Link copied to clipboard
@SerialName(value = "$dynamicAnchor")
abstract val dynamicAnchor: String?
Link copied to clipboard
@SerialName(value = "$dynamicRef")
abstract val dynamicRef: String?
Link copied to clipboard
Link copied to clipboard
abstract val examples: List<JsonElement>?
Link copied to clipboard
@SerialName(value = "$id")
abstract val id: String?
Link copied to clipboard
Link copied to clipboard
abstract val not: PropertyDefinition?
Link copied to clipboard
abstract override val nullable: Boolean?

Whether the property can be null.

Link copied to clipboard
abstract val oneOf: List<PropertyDefinition>?
Link copied to clipboard
abstract val readOnly: Boolean?
Link copied to clipboard
@SerialName(value = "$ref")
abstract val ref: String?
Link copied to clipboard
Link copied to clipboard
abstract val title: String?
Link copied to clipboard
abstract override val type: List<String>?

The data type of the property.

Link copied to clipboard
abstract val writeOnly: Boolean?

Functions

Link copied to clipboard
abstract fun getTypedConst(): T?

Returns the const value converted to the native Kotlin type T. Returns null if the value is null or cannot be converted to type T.

Link copied to clipboard
abstract fun getTypedDefault(): T?

Returns the default value converted to the native Kotlin type T. Returns null if the value is null or cannot be converted to type T.