Skip to content

Simple generate a Json Schema for your Python Classes

License

Notifications You must be signed in to change notification settings

bmsuisse/python2jsonschema

Repository files navigation

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

About

Simple generate a Json Schema for your Python Classes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages