File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
services/web/server/src/simcore_service_webserver Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 12
12
from models_library .basic_types import NonNegativeDecimal
13
13
from models_library .emails import LowerCaseEmailStr
14
14
from models_library .products import ProductName , StripePriceID , StripeTaxRateID
15
- from models_library .utils .change_case import snake_to_camel
16
15
from pydantic import (
17
16
BaseModel ,
18
17
BeforeValidator ,
@@ -305,12 +304,11 @@ def _update_json_schema_extra(schema: JsonDict) -> None:
305
304
)
306
305
307
306
model_config = ConfigDict (
308
- alias_generator = snake_to_camel ,
307
+ # NOTE: do not add aliases. Use ProductGet schema for rest API
309
308
from_attributes = True ,
310
309
frozen = True ,
311
310
json_schema_extra = _update_json_schema_extra ,
312
311
str_strip_whitespace = True ,
313
- validate_by_alias = True ,
314
312
validate_by_name = True ,
315
313
extra = "ignore" ,
316
314
)
@@ -337,13 +335,12 @@ def to_statics(self) -> dict[str, Any]:
337
335
},
338
336
exclude_none = True ,
339
337
exclude_unset = True ,
340
- by_alias = True ,
341
338
)
342
339
343
340
def get_template_name_for (self , filename : str ) -> str | None :
344
341
"""Checks for field marked with 'x_template_name' that fits the argument"""
345
342
template_name = filename .removesuffix (".jinja2" )
346
- for name , field in self .model_fields .items ():
343
+ for name , field in self .__class__ . model_fields .items ():
347
344
if (
348
345
field .json_schema_extra
349
346
and field .json_schema_extra .get ("x_template_name" ) == template_name # type: ignore[union-attr]
Original file line number Diff line number Diff line change 7
7
from aiohttp .client import ClientSession
8
8
from aiohttp .client_exceptions import ClientConnectionError , ClientError
9
9
from common_library .json_serialization import json_dumps
10
+ from models_library .utils .change_case import snake_to_camel
10
11
from packaging .version import Version
11
12
from servicelib .aiohttp .client_session import get_client_session
12
13
from tenacity .asyncio import AsyncRetrying
@@ -122,7 +123,9 @@ async def create_and_cache_statics_json(app: web.Application) -> None:
122
123
data = deepcopy (common )
123
124
124
125
_logger .debug ("Product %s" , product .name )
125
- data .update (product .to_statics ())
126
+
127
+ product_data = {snake_to_camel (k ): v for k , v in product .to_statics ().items ()}
128
+ data .update (product_data )
126
129
127
130
# Adds specifics to login settings
128
131
if (p := product .login_settings ) and (v := p .get ("LOGIN_2FA_REQUIRED" , None )):
You can’t perform that action at this time.
0 commit comments