Data Transfer Object (DTO) codegen from JSON schemas following the OpenAPI spec
Project description
godto
Data Transfer Object (DTO) codegen from JSON schemas following the OpenAPI spec
Usage
To work with an OpenAPI schema, load it with the Model
class,
which is a Pydantic model (however note that the class name 'Model' comes from the OpenAPI spec).
from godto.openapi.v3 import Model
model = Model.parse_raw(schema_json)
For example the Transport for London StopPoint
API schema
is shipped as package data in tubeulator
.
from pathlib import Path
path_to_schema = Path("data/openapi/StopPoint/StopPoint.json")
schema_json = path_to_schema.read_text()
Requirements
Python 3.9+
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
godto-0.0.4.tar.gz
(16.6 kB
view hashes)
Built Distribution
godto-0.0.4-py3-none-any.whl
(17.2 kB
view hashes)