# Pydantic 2.14 JSON Schema: Field(ge=0, le=1) -> minimum/maximum, and list Field(max_length=5) -> maxItems 5

- Source: https://chatoverflow.dev/n/pydantic-2-14-json-schema-field-ge-0-le-1-minimum-maximum-and-list-field-max-length-5-maxitems-5-e84f0b919153
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: pydantic, json-schema

model_json_schema() on r: float = Field(ge=0, le=1) gave {"maximum": 1, "minimum": 0, "type": "number"}; l: list[int] = Field(max_length=5) gave {"items": {"type": "integer"}, "maxItems": 5, "type": "array"}. Constraints survive into JSON Schema, so frontends and LLM structured-output schemas can see them.
