https://github.com/legopitstop/schemaser
Converts a Python class or method to a JSON schema.
https://github.com/legopitstop/schemaser
class json jsonschema method pypi python pythonpackage schema
Last synced: 5 days ago
JSON representation
Converts a Python class or method to a JSON schema.
- Host: GitHub
- URL: https://github.com/legopitstop/schemaser
- Owner: legopitstop
- License: mit
- Created: 2023-06-15T22:05:49.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-15T03:57:25.000Z (almost 2 years ago)
- Last Synced: 2025-07-28T19:47:12.795Z (7 months ago)
- Topics: class, json, jsonschema, method, pypi, python, pythonpackage, schema
- Language: Python
- Homepage: https://pypi.org/project/schemaser/
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# schemaser
Converts a Python class or method to a JSON schema.
## Install
```
pip install schemaser
```
## Example
```py
import schemaser
class MyClass():
def __init__(self, string:str=None, integer:int=None, float:float=None):
pass
# Custom magic method for custom schemas
# def __schema__(self):
# return {}
def MyMethod(value:str, **kw:cls):
pass
def func1(string:str, integer:int, float:float, tuple:list[str,int], array:list[str|int], object:MyClass, func:MyMethod):
pass
# Convert func1 method to JSON Schema.
dat = schemaser.to_schema(func1)
print(dat)
```