Skip to content

Commit 5285367

Browse files
committed
new example
1 parent aeab902 commit 5285367

File tree

2 files changed

+29
-16
lines changed

2 files changed

+29
-16
lines changed

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

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class LicensedItemRpcGet(BaseModel):
2626
pricing_plan_id: PricingPlanId
2727
created_at: datetime
2828
modified_at: datetime
29+
2930
model_config = ConfigDict(
3031
json_schema_extra={
3132
"examples": [
@@ -76,21 +77,33 @@ class LicensedItemRestGet(OutputSchema):
7677
created_at: datetime
7778
modified_at: datetime
7879

79-
model_config = ConfigDict(
80-
json_schema_extra={
81-
"examples": [
82-
{
83-
"licensed_item_id": "0362b88b-91f8-4b41-867c-35544ad1f7a1",
84-
"display_name": "best-model",
85-
"licensed_resource_type": f"{LicensedResourceType.VIP_MODEL}",
86-
"licensed_resource_data": cast(JsonDict, VIP_DETAILS_EXAMPLE),
87-
"pricing_plan_id": "15",
88-
"created_at": "2024-12-12 09:59:26.422140",
89-
"modified_at": "2024-12-12 09:59:26.422140",
90-
}
91-
]
92-
}
93-
)
80+
@staticmethod
81+
def _update_json_schema_extra(schema: JsonDict) -> None:
82+
schema.update(
83+
{
84+
"examples": [
85+
{
86+
"licensedItemId": "0362b88b-91f8-4b41-867c-35544ad1f7a1",
87+
"displayName": "my best model",
88+
"licensedResourceName": "best-model",
89+
"licensedResourceType": f"{LicensedResourceType.VIP_MODEL}",
90+
"licensedResourceData": cast(
91+
JsonDict,
92+
{
93+
"categoryId": "HumanWholeBody",
94+
"categoryDisplay": "Humans",
95+
"source": VIP_DETAILS_EXAMPLE,
96+
},
97+
),
98+
"pricingPlanId": "15",
99+
"createdAt": "2024-12-12 09:59:26.422140",
100+
"modifiedAt": "2024-12-12 09:59:26.422140",
101+
}
102+
]
103+
}
104+
)
105+
106+
model_config = ConfigDict(json_schema_extra=_update_json_schema_extra)
94107

95108
@classmethod
96109
def from_domain_model(cls, item: LicensedItem) -> Self:

packages/models-library/src/models_library/licenses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class LicensedResourceType(StrAutoEnum):
2626
"age": "34 years",
2727
"weight": "70.2 Kg",
2828
"height": "1.77 m",
29-
"data": "2015-03-01",
29+
"date": "2015-03-01",
3030
"ethnicity": "Caucasian",
3131
"functionality": "Static",
3232
"additional_field": "allowed",

0 commit comments

Comments
 (0)