Skip to content

Commit f87ccb4

Browse files
committed
@pcrespov move model_config below fields
1 parent 115a60f commit f87ccb4

File tree

1 file changed

+15
-15
lines changed
  • services/api-server/src/simcore_service_api_server/models/schemas

1 file changed

+15
-15
lines changed

services/api-server/src/simcore_service_api_server/models/schemas/model_adapter.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040

4141

4242
class GetCreditPriceLegacy(BaseModel):
43-
model_config = ConfigDict(
44-
populate_by_name=True,
45-
)
4643
product_name: str = Field(alias="productName")
4744
usd_per_credit: (
4845
Annotated[
@@ -62,6 +59,9 @@ class GetCreditPriceLegacy(BaseModel):
6259
"Can be None if this product's price is UNDEFINED",
6360
alias="minPaymentAmountUsd",
6461
)
62+
model_config = ConfigDict(
63+
populate_by_name=True,
64+
)
6565

6666

6767
assert set(GetCreditPriceLegacy.model_fields.keys()) == set(
@@ -70,16 +70,16 @@ class GetCreditPriceLegacy(BaseModel):
7070

7171

7272
class PricingUnitGetLegacy(BaseModel):
73-
model_config = ConfigDict(
74-
populate_by_name=True,
75-
)
7673
pricing_unit_id: PricingUnitId = Field(alias="pricingUnitId")
7774
unit_name: str = Field(alias="unitName")
7875
unit_extra_info: UnitExtraInfo = Field(alias="unitExtraInfo")
7976
current_cost_per_unit: Annotated[
8077
Decimal, PlainSerializer(float, return_type=NonNegativeFloat, when_used="json")
8178
] = Field(alias="currentCostPerUnit")
8279
default: bool
80+
model_config = ConfigDict(
81+
populate_by_name=True,
82+
)
8383

8484

8585
assert set(PricingUnitGetLegacy.model_fields.keys()) == set(
@@ -88,9 +88,6 @@ class PricingUnitGetLegacy(BaseModel):
8888

8989

9090
class WalletGetWithAvailableCreditsLegacy(BaseModel):
91-
model_config = ConfigDict(
92-
populate_by_name=True,
93-
)
9491
wallet_id: WalletID = Field(alias="walletId")
9592
name: IDStr
9693
description: str | None = None
@@ -102,6 +99,9 @@ class WalletGetWithAvailableCreditsLegacy(BaseModel):
10299
available_credits: Annotated[
103100
Decimal, PlainSerializer(float, return_type=NonNegativeFloat, when_used="json")
104101
] = Field(alias="availableCredits")
102+
model_config = ConfigDict(
103+
populate_by_name=True,
104+
)
105105

106106

107107
assert set(WalletGetWithAvailableCreditsLegacy.model_fields.keys()) == set(
@@ -110,16 +110,16 @@ class WalletGetWithAvailableCreditsLegacy(BaseModel):
110110

111111

112112
class ServicePricingPlanGetLegacy(BaseModel):
113-
model_config = ConfigDict(
114-
populate_by_name=True,
115-
)
116113
pricing_plan_id: PricingPlanId = Field(alias="pricingPlanId")
117114
display_name: str = Field(alias="displayName")
118115
description: str
119116
classification: PricingPlanClassification
120117
created_at: datetime = Field(alias="createdAt")
121118
pricing_plan_key: str = Field(alias="pricingPlanKey")
122119
pricing_units: list[PricingUnitGetLegacy] = Field(alias="pricingUnits")
120+
model_config = ConfigDict(
121+
populate_by_name=True,
122+
)
123123

124124

125125
assert set(ServicePricingPlanGetLegacy.model_fields.keys()) == set(
@@ -128,15 +128,15 @@ class ServicePricingPlanGetLegacy(BaseModel):
128128

129129

130130
class LicensedItemGet(BaseModel):
131-
model_config = ConfigDict(
132-
populate_by_name=True,
133-
)
134131
licensed_item_id: LicensedItemID
135132
name: str
136133
licensed_resource_type: LicensedResourceType
137134
pricing_plan_id: PricingPlanId
138135
created_at: datetime
139136
modified_at: datetime
137+
model_config = ConfigDict(
138+
populate_by_name=True,
139+
)
140140

141141

142142
assert set(LicensedItemGet.model_fields.keys()) == set(

0 commit comments

Comments
 (0)