enum

var enum: Any?(source)

List of allowed object values (enumeration).

Accepts List, List, or null. Map values are automatically converted to JsonObject. Throws IllegalArgumentException for non-object types to prevent semantically invalid schemas.

This is less common but valid for schemas that allow only specific object instances.

Example with JsonObject

obj {
description = "Allowed configurations"
enum = listOf(
JsonObject(mapOf("mode" to JsonPrimitive("read"))),
JsonObject(mapOf("mode" to JsonPrimitive("write")))
)
}

Example with Map (convenience)

obj {
description = "Allowed configurations"
enum = listOf(
mapOf("mode" to "read"),
mapOf("mode" to "write")
)
}