Skip to content

Commit f7c82c2

Browse files
committed
allow to populate cover models by name
1 parent 947ffd8 commit f7c82c2

File tree

1 file changed

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

1 file changed

+20
-1
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,20 @@
2525
)
2626
from models_library.users import GroupID
2727
from models_library.wallets import WalletID, WalletStatus
28-
from pydantic import BaseModel, Field, NonNegativeFloat, NonNegativeInt, PlainSerializer
28+
from pydantic import (
29+
BaseModel,
30+
ConfigDict,
31+
Field,
32+
NonNegativeFloat,
33+
NonNegativeInt,
34+
PlainSerializer,
35+
)
2936

3037

3138
class GetCreditPriceLegacy(BaseModel):
39+
model_config = ConfigDict(
40+
populate_by_name=True,
41+
)
3242
product_name: str = Field(alias="productName")
3343
usd_per_credit: (
3444
Annotated[
@@ -56,6 +66,9 @@ class GetCreditPriceLegacy(BaseModel):
5666

5767

5868
class PricingUnitGetLegacy(BaseModel):
69+
model_config = ConfigDict(
70+
populate_by_name=True,
71+
)
5972
pricing_unit_id: PricingUnitId = Field(alias="pricingUnitId")
6073
unit_name: str = Field(alias="unitName")
6174
unit_extra_info: UnitExtraInfo = Field(alias="unitExtraInfo")
@@ -71,6 +84,9 @@ class PricingUnitGetLegacy(BaseModel):
7184

7285

7386
class WalletGetWithAvailableCreditsLegacy(BaseModel):
87+
model_config = ConfigDict(
88+
populate_by_name=True,
89+
)
7490
wallet_id: WalletID = Field(alias="walletId")
7591
name: IDStr
7692
description: str | None = None
@@ -90,6 +106,9 @@ class WalletGetWithAvailableCreditsLegacy(BaseModel):
90106

91107

92108
class ServicePricingPlanGetLegacy(BaseModel):
109+
model_config = ConfigDict(
110+
populate_by_name=True,
111+
)
93112
pricing_plan_id: PricingPlanId = Field(alias="pricingPlanId")
94113
display_name: str = Field(alias="displayName")
95114
description: str

0 commit comments

Comments
 (0)