kiwi-simple-metrics/min_fail_example.py

26 lines
429 B
Python
Raw Normal View History

2023-08-30 23:28:04 +00:00
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()