mirror of
https://github.com/yavook/kiwi-simple-metrics.git
synced 2024-11-24 08:23:01 +00:00
25 lines
429 B
Python
25 lines
429 B
Python
from pydantic import BaseModel
|
|
|
|
|
|
class SubModel(BaseModel):
|
|
optional: int = 42
|
|
required: str
|
|
|
|
|
|
class Settings(BaseModel):
|
|
sub: SubModel = SubModel(required="foo")
|
|
sub2: SubModel = SubModel(required="bar")
|
|
|
|
|
|
def main() -> None:
|
|
settings = Settings.model_validate({
|
|
"sub": {"optional": "69"},
|
|
})
|
|
|
|
# settings = Settings()
|
|
|
|
print(settings.model_dump())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|