OpenAPI 3.0 specs parser and client/server generator
Project description
OpenAPI 3.0 Parser
This package provides functionality to analyze OpenAPI 3.0 specifications and build clients and servers from that specification.
Example Usage
import yaml
from openapi_parser.exporter import ModelWriter
from openapi_parser.parser.loader import *
from openapi_parser.parser.model import *
JUSTIFICATION_SIZE = 80
def main():
with open('data/petshop.yaml', 'rt', encoding='utf8') as f:
schema = yaml.safe_load(f)
parser = OpenApiParser(schema)
parser.load_all()
writer = ModelWriter()
for path, mdl in parser.loaded_objects.items():
print(('# ' + type(mdl).__name__ + (f" '{mdl.property_name}'" if isinstance(mdl, ModelSchemaImpl) else '')).ljust(JUSTIFICATION_SIZE, ' ') + f" -- '{path}'")
print('# ' + '=' * JUSTIFICATION_SIZE)
print('')
with open('.code-gen/petshop.py', 'wt', encoding='utf8') as output:
writer.write_model(parser, stream=output)
return 0
if (__name__ == '__main__'):
exit_code = main()
exit(exit_code)
TODOs:
- Model generator:
- Core functionality
- Class inheritance support
- Enums support
- Discriminator property support
- Client generator
- Server generator
- Test coverage
- Documentation
- Command-line interface
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for openapi_parser-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 491edd5740aa27f83b65e6a00cfd4de07de89ff2d09dfe7262492b33fa6d8393 |
|
MD5 | 469cb18b0258ee22ddab6471e833b979 |
|
BLAKE2b-256 | 04fa2c4621c6505a37ef824d694d9a10333cb589f187876ae409513292dbcf8f |