File tree Expand file tree Collapse file tree 1 file changed +24
-17
lines changed
packages/models-library/src/models_library/api_schemas_webserver Expand file tree Collapse file tree 1 file changed +24
-17
lines changed Original file line number Diff line number Diff line change 1616 ValidationInfo ,
1717 field_validator ,
1818)
19+ from pydantic .config import JsonDict
1920from simcore_postgres_database .utils_users import MIN_USERNAME_LEN
2021
2122from ..basic_types import IDStr
@@ -82,27 +83,33 @@ class MyProfileGet(OutputSchemaWithoutCamelCase):
8283 privacy : MyProfilePrivacyGet
8384 preferences : AggregatedPreferences
8485
86+ @staticmethod
87+ def _update_json_schema_extra (schema : JsonDict ) -> None :
88+ schema .update (
89+ {
90+ "examples" : [
91+ {
92+ "id" : 42 ,
93+ 94+ "userName" : "bla42" ,
95+ "role" : "admin" , # pre
96+ "expirationDate" : "2022-09-14" , # optional
97+ "preferences" : {},
98+ "privacy" : {
99+ "hide_username" : 0 ,
100+ "hide_fullname" : 0 ,
101+ "hide_email" : 1 ,
102+ },
103+ },
104+ ]
105+ }
106+ )
107+
85108 model_config = ConfigDict (
86109 # NOTE: old models have an hybrid between snake and camel cases!
87110 # Should be unified at some point
88111 populate_by_name = True ,
89- json_schema_extra = {
90- "examples" : [
91- {
92- "id" : 42 ,
93- 94- "userName" : "bla42" ,
95- "role" : "admin" , # pre
96- "expirationDate" : "2022-09-14" , # optional
97- "preferences" : {},
98- "privacy" : {
99- "hide_username" : 0 ,
100- "hide_fullname" : 0 ,
101- "hide_email" : 1 ,
102- },
103- },
104- ]
105- },
112+ json_schema_extra = _update_json_schema_extra ,
106113 )
107114
108115 @field_validator ("role" , mode = "before" )
You can’t perform that action at this time.
0 commit comments