Package io.github.glaforge.gemini.schema
Class ArraySchema
java.lang.Object
io.github.glaforge.gemini.schema.Schema
io.github.glaforge.gemini.schema.ArraySchema
Schema for Array types.
Example usage:
arr()
.items(str())
.minItems(1);
-
Field Summary
Fields inherited from class io.github.glaforge.gemini.schema.Schema
description, nullable, title, type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDefine the schema for items in this array.maxItems(int max) Set the maximum number of items.minItems(int min) Set the minimum number of items.prefixItems(Schema... schemas) Define the schema for the first N items (prefixItems).toMap()Convert this Schema object into a Map suitable for JSON serialization.
-
Constructor Details
-
ArraySchema
public ArraySchema()Initializes a new array schema.
-
-
Method Details
-
items
Define the schema for items in this array.- Parameters:
itemsSchema- The schema for the items.- Returns:
- The ArraySchema instance.
-
minItems
Set the minimum number of items.- Parameters:
min- The minimum number of items.- Returns:
- The ArraySchema instance.
-
maxItems
Set the maximum number of items.- Parameters:
max- The maximum number of items.- Returns:
- The ArraySchema instance.
-
prefixItems
Define the schema for the first N items (prefixItems).- Parameters:
schemas- The schemas for the prefix items.- Returns:
- The ArraySchema instance.
-
toMap
Description copied from class:SchemaConvert this Schema object into a Map suitable for JSON serialization.
-