@@ -3635,25 +3635,75 @@ conint/confloat with ge/le parameters.
36353635 "title": "NumberConstraints",
36363636 "type": "object",
36373637 "properties": {
3638- "non_negative_count ": {
3638+ "non_negative_int ": {
36393639 "type": "integer",
36403640 "minimum": 0,
3641- "description": "A count that cannot be negative "
3641+ "description": "NonNegativeInt: minimum=0 only "
36423642 },
3643- "non_positive_balance ": {
3643+ "non_positive_int ": {
36443644 "type": "integer",
36453645 "maximum": 0,
3646- "description": "A balance that cannot be positive "
3646+ "description": "NonPositiveInt: maximum=0 only "
36473647 },
3648- "non_negative_amount ": {
3648+ "non_negative_float ": {
36493649 "type": "number",
36503650 "minimum": 0,
3651- "description": "An amount that cannot be negative "
3651+ "description": "NonNegativeFloat: minimum=0 only "
36523652 },
3653- "non_positive_score ": {
3653+ "non_positive_float ": {
36543654 "type": "number",
36553655 "maximum": 0,
3656- "description": "A score that cannot be positive"
3656+ "description": "NonPositiveFloat: maximum=0 only"
3657+ },
3658+ "positive_int": {
3659+ "type": "integer",
3660+ "exclusiveMinimum": 0,
3661+ "description": "PositiveInt: exclusiveMinimum=0"
3662+ },
3663+ "negative_int": {
3664+ "type": "integer",
3665+ "exclusiveMaximum": 0,
3666+ "description": "NegativeInt: exclusiveMaximum=0"
3667+ },
3668+ "positive_float": {
3669+ "type": "number",
3670+ "exclusiveMinimum": 0,
3671+ "description": "PositiveFloat: exclusiveMinimum=0"
3672+ },
3673+ "negative_float": {
3674+ "type": "number",
3675+ "exclusiveMaximum": 0,
3676+ "description": "NegativeFloat: exclusiveMaximum=0"
3677+ },
3678+ "bounded_non_negative_int": {
3679+ "type": "integer",
3680+ "minimum": 0,
3681+ "maximum": 100,
3682+ "description": "NonNegativeInt with additional upper bound"
3683+ },
3684+ "bounded_non_positive_int": {
3685+ "type": "integer",
3686+ "maximum": 0,
3687+ "minimum": -100,
3688+ "description": "NonPositiveInt with additional lower bound"
3689+ },
3690+ "bounded_non_negative_float": {
3691+ "type": "number",
3692+ "minimum": 0,
3693+ "maximum": 1.0,
3694+ "description": "NonNegativeFloat with additional upper bound"
3695+ },
3696+ "bounded_non_positive_float": {
3697+ "type": "number",
3698+ "maximum": 0,
3699+ "minimum": -1.0,
3700+ "description": "NonPositiveFloat with additional lower bound"
3701+ },
3702+ "plain_constrained_int": {
3703+ "type": "integer",
3704+ "minimum": 5,
3705+ "maximum": 100,
3706+ "description": "No zero bound: should remain conint/Field"
36573707 }
36583708 }
36593709 }
@@ -3671,25 +3721,58 @@ conint/confloat with ge/le parameters.
36713721 from pydantic import (
36723722 BaseModel,
36733723 Field,
3724+ NegativeFloat,
3725+ NegativeInt,
36743726 NonNegativeFloat,
36753727 NonNegativeInt,
36763728 NonPositiveFloat,
36773729 NonPositiveInt,
3730+ PositiveFloat,
3731+ PositiveInt,
3732+ confloat,
3733+ conint,
36783734 )
36793735
36803736
36813737 class NumberConstraints(BaseModel):
3682- non_negative_count: NonNegativeInt | None = Field(
3683- None, description='A count that cannot be negative'
3738+ non_negative_int: NonNegativeInt | None = Field(
3739+ None, description='NonNegativeInt: minimum=0 only'
3740+ )
3741+ non_positive_int: NonPositiveInt | None = Field(
3742+ None, description='NonPositiveInt: maximum=0 only'
3743+ )
3744+ non_negative_float: NonNegativeFloat | None = Field(
3745+ None, description='NonNegativeFloat: minimum=0 only'
3746+ )
3747+ non_positive_float: NonPositiveFloat | None = Field(
3748+ None, description='NonPositiveFloat: maximum=0 only'
3749+ )
3750+ positive_int: PositiveInt | None = Field(
3751+ None, description='PositiveInt: exclusiveMinimum=0'
3752+ )
3753+ negative_int: NegativeInt | None = Field(
3754+ None, description='NegativeInt: exclusiveMaximum=0'
3755+ )
3756+ positive_float: PositiveFloat | None = Field(
3757+ None, description='PositiveFloat: exclusiveMinimum=0'
3758+ )
3759+ negative_float: NegativeFloat | None = Field(
3760+ None, description='NegativeFloat: exclusiveMaximum=0'
3761+ )
3762+ bounded_non_negative_int: conint(ge=0, le=100) | None = Field(
3763+ None, description='NonNegativeInt with additional upper bound'
3764+ )
3765+ bounded_non_positive_int: conint(ge=-100, le=0) | None = Field(
3766+ None, description='NonPositiveInt with additional lower bound'
36843767 )
3685- non_positive_balance: NonPositiveInt | None = Field(
3686- None, description='A balance that cannot be positive '
3768+ bounded_non_negative_float: confloat(ge=0.0, le=1.0) | None = Field(
3769+ None, description='NonNegativeFloat with additional upper bound '
36873770 )
3688- non_negative_amount: NonNegativeFloat | None = Field(
3689- None, description='An amount that cannot be negative '
3771+ bounded_non_positive_float: confloat(ge=-1.0, le=0.0) | None = Field(
3772+ None, description='NonPositiveFloat with additional lower bound '
36903773 )
3691- non_positive_score: NonPositiveFloat | None = Field(
3692- None, description='A score that cannot be positive '
3774+ plain_constrained_int: conint(ge=5, le=100) | None = Field(
3775+ None, description='No zero bound: should remain conint/Field '
36933776 )
36943777 ```
36953778
0 commit comments