Skip to content

Latest commit

 

History

History
35 lines (19 loc) · 748 Bytes

README.md

File metadata and controls

35 lines (19 loc) · 748 Bytes

python2jsonschema

PyPI version

Simple generate a Json Schema for your Python Classes

Does support recursive and complex Data Structures using ForwardRefs:

class Item(TypedDict):
    DisplayName: Required[str]
    Children: List["Union[Item,List[Item]]"]

Supports Python 3.9+ (anything below not tested)

Usage

There is currently just one method:

from python2jsonschema import get_json_schema_for_type

schema_dict = get_json_schema_for_type(Item, error_handling="raise")

# You might want to save the schema using json.dump or the like

Roadmap / Limitations

Pydantic data models are not yet supported