"type": "number" for numeric fields that may include decimals.
Supported numeric keywords
Example
number for measurements, probabilities, and currency-like values.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Numeric values with decimal support and numeric constraints.
"type": "number" for numeric fields that may include decimals.
| Keyword | What it does |
|---|---|
minimum / maximum | Inclusive numeric bounds |
exclusiveMinimum / exclusiveMaximum | Strict numeric bounds |
multipleOf | Restricts values to multiples |
{
"type": "object",
"properties": {
"score": { "type": "number", "minimum": 0, "maximum": 100 },
"temperature": { "type": "number", "exclusiveMinimum": -273.15 },
"price": { "type": "number", "minimum": 0, "multipleOf": 0.01 }
},
"required": ["score", "temperature", "price"],
"additionalProperties": false
}
from pydantic import BaseModel, ConfigDict, Field
class Payload(BaseModel):
model_config = ConfigDict(extra="forbid")
score: float = Field(..., ge=0, le=100)
temperature: float = Field(..., gt=-273.15)
price: float = Field(..., ge=0, multiple_of=0.01)
import { z } from "zod";
const payloadSchema = z
.object({
score: z.number().min(0).max(100),
temperature: z.number().gt(-273.15),
price: z.number().min(0).multipleOf(0.01),
})
.strict();
number for measurements, probabilities, and currency-like values.