Schema

@Serializable
data class Schema(val anyOf: List<Schema>? = null, val default: JsonElement? = null, val description: String? = null, val enum: List<String>? = null, val example: JsonElement? = null, val format: String? = null, val items: Schema? = null, val maxItems: Long? = null, val maxLength: Long? = null, val maxProperties: Long? = null, val maximum: Double? = null, val minItems: Long? = null, val minLength: Long? = null, val minProperties: Long? = null, val minimum: Double? = null, val nullable: Boolean? = null, val pattern: String? = null, val properties: Map<String, Schema>? = null, val propertyOrdering: List<String>? = null, val required: List<String>? = null, val title: String? = null, val type: Type? = null)

Schema is used to define the format of input/output data.

Represents a select subset of an OpenAPI 3.0 schema object. More fields may be added in the future as needed.

Constructors

Link copied to clipboard
constructor(anyOf: List<Schema>? = null, default: JsonElement? = null, description: String? = null, enum: List<String>? = null, example: JsonElement? = null, format: String? = null, items: Schema? = null, maxItems: Long? = null, maxLength: Long? = null, maxProperties: Long? = null, maximum: Double? = null, minItems: Long? = null, minLength: Long? = null, minProperties: Long? = null, minimum: Double? = null, nullable: Boolean? = null, pattern: String? = null, properties: Map<String, Schema>? = null, propertyOrdering: List<String>? = null, required: List<String>? = null, title: String? = null, type: Type? = null)

Properties

Link copied to clipboard
val anyOf: List<Schema>? = null

Optional. The instance must be valid against any (one or more) of the subschemas listed in any_of.

Link copied to clipboard
val default: JsonElement? = null

Optional. Default value to use if the field is not specified.

Link copied to clipboard
val description: String? = null

Optional. Describes the data. The model uses this field to understand the purpose of the schema and how to use it. It is a best practice to provide a clear and descriptive explanation for the schema and its properties here, rather than in the prompt.

Link copied to clipboard
val enum: List<String>? = null

Optional. Possible values of the field. This field can be used to restrict a value to a fixed set of values. To mark a field as an enum, set format to enum and provide the list of possible values in enum. For example: 1. To define directions: {type:STRING, format:enum, enum:["EAST", "NORTH", "SOUTH", "WEST"]} 2. To define apartment numbers: {type:INTEGER, format:enum, enum:["101", "201", "301"]}

Link copied to clipboard
val example: JsonElement? = null

Optional. Example of an instance of this schema.

Link copied to clipboard
val format: String? = null

Optional. The format of the data. For NUMBER type, format can be float or double. For INTEGER type, format can be int32 or int64. For STRING type, format can be email, byte, date, date-time, password, and other formats to further refine the data type.

Link copied to clipboard
val items: Schema? = null

Optional. If type is ARRAY, items specifies the schema of elements in the array.

Link copied to clipboard
val maximum: Double? = null

Optional. If type is INTEGER or NUMBER, maximum specifies the maximum allowed value.

Link copied to clipboard
val maxItems: Long? = null

Optional. If type is ARRAY, max_items specifies the maximum number of items in an array.

Link copied to clipboard
val maxLength: Long? = null

Optional. If type is STRING, max_length specifies the maximum length of the string.

Link copied to clipboard
val maxProperties: Long? = null

Optional. If type is OBJECT, max_properties specifies the maximum number of properties that can be provided.

Link copied to clipboard
val minimum: Double? = null

Optional. If type is INTEGER or NUMBER, minimum specifies the minimum allowed value.

Link copied to clipboard
val minItems: Long? = null

Optional. If type is ARRAY, min_items specifies the minimum number of items in an array.

Link copied to clipboard
val minLength: Long? = null

Optional. If type is STRING, min_length specifies the minimum length of the string.

Link copied to clipboard
val minProperties: Long? = null

Optional. If type is OBJECT, min_properties specifies the minimum number of properties that can be provided.

Link copied to clipboard
val nullable: Boolean? = null

Optional. Indicates if the value of this field can be null.

Link copied to clipboard
val pattern: String? = null

Optional. If type is STRING, pattern specifies a regular expression that the string must match.

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

Optional. If type is OBJECT, properties is a map of property names to schema definitions for each property of the object.

Link copied to clipboard

Optional. Order of properties displayed or used where order matters. This is not a standard field in OpenAPI specification, but can be used to control the order of properties.

Link copied to clipboard
val required: List<String>? = null

Optional. If type is OBJECT, required lists the names of properties that must be present.

Link copied to clipboard
val title: String? = null

Optional. Title for the schema.

Link copied to clipboard
val type: Type? = null

Optional. Data type of the schema field.