From 5643f5fac9d581b32250cb15570a68c795fca1b5 Mon Sep 17 00:00:00 2001 From: = <=> Date: Fri, 13 Jan 2023 10:23:20 -0500 Subject: [PATCH] cleanup --- t.py | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 t.py diff --git a/t.py b/t.py deleted file mode 100644 index 8355cc1..0000000 --- a/t.py +++ /dev/null @@ -1,43 +0,0 @@ -# output-json -from __future__ import annotations -from pydantic import BaseModel, Field -from typing import Optional - - -class Person(BaseModel): - name: str - age: int = Field(lt=100, gt=0) - test: Optional[int] = 0 - - # class Config: - # schema_extra = { - # 'examples': [ - # { - # 'name': 'John Doe', - # 'age': 25, - # } - # ] - # } - -data = { - 'name': 'Kenneth Reitz', - 'age': 34, -} - -# 'inner_schema': {'fields': {'age': {'required': True, -# 'schema': {'type': 'int'}}, -# 'metadata': {'required': True, -# 'schema': {'type': 'dict'}}, -# 'name': {'required': True, -# 'schema': {'type': 'str'}}}, -# Person.model_rebuild() -p = Person(**data) - - -# print(p) -from pprint import pprint - -pprint(p.json_schema()) - - -# print(Person.schema_json(indent=2))