Metadata-Version: 2.4
Name: openapiart
Version: 0.3.35
Summary: The OpenAPI Artifact Generator Python Package
Author-email: Keysight Technologies <andy.balogh@keysight.com>
License-Expression: MIT
Project-URL: Repository, https://github.com/open-traffic-generator/openapiart
Keywords: testing,openapi,artifact,generator
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Testing :: Traffic Generation
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: <4,>=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: build
Requires-Dist: jsonpath-ng
Requires-Dist: typing
Requires-Dist: setuptools
Requires-Dist: wheel
Requires-Dist: PyYAML
Requires-Dist: openapi_spec_validator==0.3.0
Requires-Dist: requests
Requires-Dist: typing_extensions
Requires-Dist: click==8.1.7
Requires-Dist: black==22.3.0
Requires-Dist: grpcio-tools~=1.70.0
Requires-Dist: pipreqs==0.4.11
Requires-Dist: protobuf~=5.29.5
Requires-Dist: grpcio~=1.70.0
Provides-Extra: testing
Requires-Dist: twine; extra == "testing"
Requires-Dist: flask; python_version <= "3.6" and extra == "testing"
Requires-Dist: flask==2.2.5; python_version > "3.6" and extra == "testing"
Requires-Dist: pytest; extra == "testing"
Requires-Dist: flake8; extra == "testing"
Requires-Dist: pytest-cov; extra == "testing"
Requires-Dist: jsonpath_ng; extra == "testing"
Requires-Dist: urllib3; extra == "testing"
Requires-Dist: semantic_version; extra == "testing"
Dynamic: license-file

# openapiart - OpenAPI Artifact Generator

[![CICD](https://github.com/open-traffic-generator/openapiart/workflows/CICD/badge.svg)](https://github.com/open-traffic-generator/openapiart/actions)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![python](https://img.shields.io/pypi/pyversions/openapiart.svg)](https://pypi.python.org/pypi/openapiart)
[![license](https://img.shields.io/badge/license-MIT-green.svg)](https://en.wikipedia.org/wiki/MIT_License)

The `OpenAPIArt` (OpenAPI Artifact Generator) python package does the following:
- pre-processes OpenAPI yaml files according to the [MODELGUIDE](../main/MODELGUIDE.md)
- using the path keyword bundles all dependency OpenAPI yaml files into a single openapi.yaml file
- post-processes any [MODELGUIDE](../main/MODELGUIDE.md) extensions
- validates the bundled openapi.yaml file
- generates a `.proto` file from the openapi file
- optionally generates a static redocly documentation file 
- optionally generates a `python ux sdk` from the openapi file
- optionally generates a `go ux sdk` from the openapi file

## Getting started
Install the package
```
pip install openapiart
```

Generate artifacts from OpenAPI files
```python
""" 
The following command will produce these artifacts:
    - ./artifacts/openapi.yaml
    - ./artifacts/openapi.json
    - ./artifacts/openapi.html
    - ./artifacts/sample.proto
    - ./artifacts/sample/__init__.py
    - ./artifacts/sample/sample.py
    - ./artifacts/sample/sample_pb2.py
    - ./artifacts/sample/sample_pb2_grpc.py
    - ./pkg/openapiart.go
    - ./pkg/go.mod
    - ./pkg/go.sum
    - ./pkg/sanity/sanity_grpc.pb.go
    - ./pkg/sanity/sanity.pb.go
"""
import openapiart

# bundle api files
# validate the bundled file
# generate the documentation file
art = openapiart.OpenApiArt(
    api_files=[
        "./openapiart/tests/api/info.yaml",
        "./openapiart/tests/common/common.yaml",
        "./openapiart/tests/api/api.yaml",
    ],
    artifact_dir="./artifacts",
    protobuf_name="sanity",
    extension_prefix="sanity",
)

# optionally generate a python ux sdk and python protobuf/grpc stubs
art.GeneratePythonSdk(
    package_name="sanity"
)

# optionally generate a go ux sdk and go protobuf/grpc stubs
art.GenerateGoSdk(
    package_dir="github.com/open-traffic-generator/openapiart/pkg", 
    package_name="openapiart"
)
```

## Specifications
> This repository is based on the [OpenAPI specification](
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md) 
which is a standard, language-agnostic interface to RESTful APIs. 

> [Modeling guide specific to this package](../main/MODELGUIDE.md)


