|
6 | 6 | from models_library.users import UserID |
7 | 7 | from models_library.wallets import WalletInfo |
8 | 8 | from pydantic import BaseModel, ConfigDict |
| 9 | +from pydantic.config import JsonDict |
9 | 10 |
|
10 | 11 |
|
11 | 12 | class DynamicServiceStart(DynamicServiceCreate): |
12 | 13 | request_dns: str |
13 | 14 | request_scheme: str |
14 | 15 | simcore_user_agent: str |
15 | 16 |
|
16 | | - model_config = ConfigDict( |
17 | | - json_schema_extra={ |
18 | | - "example": { |
19 | | - "product_name": "osparc", |
20 | | - "can_save": True, |
21 | | - "user_id": 234, |
22 | | - "project_id": "dd1d04d9-d704-4f7e-8f0f-1ca60cc771fe", |
23 | | - "service_key": "simcore/services/dynamic/3dviewer", |
24 | | - "service_version": "2.4.5", |
25 | | - "service_uuid": "75c7f3f4-18f9-4678-8610-54a2ade78eaa", |
26 | | - "request_dns": "some.local", |
27 | | - "request_scheme": "http", |
28 | | - "simcore_user_agent": "", |
29 | | - "service_resources": ServiceResourcesDictHelpers.model_config["json_schema_extra"]["examples"][0], # type: ignore [index] |
30 | | - "wallet_info": WalletInfo.model_config["json_schema_extra"]["examples"][0], # type: ignore [index] |
31 | | - "pricing_info": PricingInfo.model_config["json_schema_extra"]["examples"][0], # type: ignore [index] |
32 | | - "hardware_info": HardwareInfo.model_config["json_schema_extra"]["examples"][0], # type: ignore [index] |
| 17 | + @staticmethod |
| 18 | + def _update_json_schema_extra(schema: JsonDict) -> None: |
| 19 | + schema.update( |
| 20 | + { |
| 21 | + "example": { |
| 22 | + "product_name": "osparc", |
| 23 | + "product_api_base_url": "https://api.local", |
| 24 | + "can_save": True, |
| 25 | + "user_id": 234, |
| 26 | + "project_id": "dd1d04d9-d704-4f7e-8f0f-1ca60cc771fe", |
| 27 | + "service_key": "simcore/services/dynamic/3dviewer", |
| 28 | + "service_version": "2.4.5", |
| 29 | + "service_uuid": "75c7f3f4-18f9-4678-8610-54a2ade78eaa", |
| 30 | + "request_dns": "some.local", |
| 31 | + "request_scheme": "http", |
| 32 | + "simcore_user_agent": "", |
| 33 | + "service_resources": ServiceResourcesDictHelpers.model_config["json_schema_extra"]["examples"][0], # type: ignore [index] |
| 34 | + "wallet_info": WalletInfo.model_config["json_schema_extra"]["examples"][0], # type: ignore [index] |
| 35 | + "pricing_info": PricingInfo.model_config["json_schema_extra"]["examples"][0], # type: ignore [index] |
| 36 | + "hardware_info": HardwareInfo.model_config["json_schema_extra"]["examples"][0], # type: ignore [index] |
| 37 | + } |
33 | 38 | } |
34 | | - } |
35 | | - ) |
| 39 | + ) |
| 40 | + |
| 41 | + model_config = ConfigDict(json_schema_extra=_update_json_schema_extra) |
36 | 42 |
|
37 | 43 |
|
38 | 44 | class DynamicServiceStop(BaseModel): |
|
0 commit comments