Metadata-Version: 2.1
Name: openapi-parser
Version: 0.1.0
Summary: OpenAPI 3.0 specs parser and client/server generator
Home-page: https://gitlab.com/Hares-Lab/openapi-parser
License: BSD 2-Clause License
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: License :: OSI Approved :: BSD License
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.6.0
Description-Content-Type: text/markdown
Requires-Dist: dataclasses-json (>=0.5.2)
Requires-Dist: functional-python (>=0.0.7)
Requires-Dist: stringcase (<2.0.0,==1.2.0)
Requires-Dist: lazy-object-proxy (==1.5.1) ; python_version < "3.8"
Requires-Dist: dataclasses (>=0.7) ; python_version == "3.6"
Provides-Extra: all

# OpenAPI 3.0 Parser
This package provides functionality to analyze OpenAPI 3.0 specifications
and build clients and servers from that specification.

### Example Usage
```python
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:
   - [x] Core functionality
   - [x] Class inheritance support
   - [ ] Enums support
   - [ ] Discriminator property support
 - [ ] Client generator
 - [ ] Server generator
 - [ ] Test coverage
 - [ ] Documentation
 - [ ] Command-line interface


