Skip to content

Commit 6835b73

Browse files
committed
ensure GetCreditPrice.usdPerCredit remains a float
1 parent 5f8eaff commit 6835b73

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/models-library/src/models_library/api_schemas_webserver/product.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
ConfigDict,
66
Field,
77
HttpUrl,
8+
NonNegativeFloat,
89
NonNegativeInt,
910
PlainSerializer,
1011
PositiveInt,
@@ -20,7 +21,7 @@ class GetCreditPrice(OutputSchema):
2021
product_name: str
2122
usd_per_credit: Annotated[
2223
NonNegativeDecimal,
23-
PlainSerializer(float, return_type=float, when_used="json"),
24+
PlainSerializer(float, return_type=NonNegativeFloat, when_used="json"),
2425
] | None = Field(
2526
...,
2627
description="Price of a credit in USD. "

services/api-server/openapi.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5595,7 +5595,8 @@
55955595
"usdPerCredit": {
55965596
"anyOf": [
55975597
{
5598-
"type": "string"
5598+
"type": "number",
5599+
"minimum": 0.0
55995600
},
56005601
{
56015602
"type": "null"

0 commit comments

Comments
 (0)