File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed
packages/settings-library/src/settings_library Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change 11from functools import cached_property
2+ from typing import ClassVar
23
4+ from pydantic .config import ConfigDict , JsonDict
35from pydantic .networks import AnyUrl
46from pydantic .types import SecretStr
57
810
911
1012class RabbitDsn (AnyUrl ):
11- allowed_schemes = {"amqp" , "amqps" }
13+ allowed_schemes : ClassVar [ set [ str ]] = {"amqp" , "amqps" }
1214
1315
1416class RabbitSettings (BaseCustomSettings ):
@@ -33,3 +35,32 @@ def dsn(self) -> str:
3335 )
3436 )
3537 return rabbit_dsn
38+
39+ @staticmethod
40+ def _update_json_schema_extra (schema : JsonDict ) -> None :
41+ schema .update (
42+ {
43+ "examples" : [
44+ {
45+ "RABBIT_HOST" : "rabbitmq.example.com" ,
46+ "RABBIT_USER" : "guest" ,
47+ "RABBIT_PASSWORD" : "guest-password" ,
48+ "RABBIT_SECURE" : False ,
49+ "RABBIT_PORT" : 5672 ,
50+ },
51+ {
52+ "RABBIT_HOST" : "secure.rabbitmq.example.com" ,
53+ "RABBIT_USER" : "guest" ,
54+ "RABBIT_PASSWORD" : "guest-password" ,
55+ "RABBIT_SECURE" : True ,
56+ "RABBIT_PORT" : 15672 ,
57+ },
58+ ]
59+ }
60+ )
61+
62+ model_config = ConfigDict (
63+ extra = "ignore" ,
64+ populate_by_name = True ,
65+ json_schema_extra = _update_json_schema_extra ,
66+ )
You can’t perform that action at this time.
0 commit comments