Package io.github.glaforge.gemini.schema
Class NumberSchema
java.lang.Object
io.github.glaforge.gemini.schema.Schema
io.github.glaforge.gemini.schema.NumberSchema
Schema for Number and Integer types.
Example usage:
num()
.min(0)
.max(100);
For integers:
integer()
.min(1);
-
Field Summary
Fields inherited from class io.github.glaforge.gemini.schema.Schema
description, nullable, title, type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionenumValues(double... values) Define the allowed enum values for this number.integer()Mark this number as an integer.max(double max) Set the maximum value.min(double min) Set the minimum value.toMap()Convert this Schema object into a Map suitable for JSON serialization.
-
Constructor Details
-
NumberSchema
public NumberSchema()Initializes a new number schema.
-
-
Method Details
-
integer
Mark this number as an integer.- Returns:
- The NumberSchema instance.
-
min
Set the minimum value.- Parameters:
min- The minimum value.- Returns:
- The NumberSchema instance.
-
max
Set the maximum value.- Parameters:
max- The maximum value.- Returns:
- The NumberSchema instance.
-
enumValues
Define the allowed enum values for this number.- Parameters:
values- The allowed number values.- Returns:
- The NumberSchema instance.
-
toMap
Description copied from class:SchemaConvert this Schema object into a Map suitable for JSON serialization.
-