Skip to content

Commit 290c225

Browse files
committed
✨ Add JSON schema examples to RedisSettings model configuration
1 parent e15b75a commit 290c225

File tree

1 file changed

+16
-0
lines changed
  • packages/settings-library/src/settings_library

1 file changed

+16
-0
lines changed

packages/settings-library/src/settings_library/redis.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from pydantic.networks import RedisDsn
44
from pydantic.types import SecretStr
5+
from pydantic_settings import SettingsConfigDict
56

67
from .base import BaseCustomSettings
78
from .basic_types import PortInt
@@ -45,3 +46,18 @@ def build_redis_dsn(self, db_index: RedisDatabase) -> str:
4546
path=f"{db_index}",
4647
)
4748
)
49+
50+
model_config = SettingsConfigDict(
51+
json_schema_extra={
52+
"examples": [
53+
# minimal required
54+
{
55+
"REDIS_SECURE": "0",
56+
"REDIS_HOST": "localhost",
57+
"REDIS_PORT": "6379",
58+
"REDIS_USER": "user",
59+
"REDIS_PASSWORD": "foobar", # NOSONAR
60+
}
61+
],
62+
}
63+
)

0 commit comments

Comments
 (0)