# 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)
Raw data
{
"_id": null,
"home_page": "https://github.com/open-traffic-generator/openapiart",
"name": "openapiart",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=2.7",
"maintainer_email": null,
"keywords": "testing openapi artifact generator",
"author": "https://github.com/open-traffic-generator/openapiart",
"author_email": "andy.balogh@keysight.com",
"download_url": "https://files.pythonhosted.org/packages/af/2f/ff69ae5e6cef28cf55b06210d22f3f8941d30d1b36df152d1d08d8801d34/openapiart-0.3.21.tar.gz",
"platform": null,
"description": "# openapiart - OpenAPI Artifact Generator\n\n[![CICD](https://github.com/open-traffic-generator/openapiart/workflows/CICD/badge.svg)](https://github.com/open-traffic-generator/openapiart/actions)\n[![Project Status: Active \u2013 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)\n[![python](https://img.shields.io/pypi/pyversions/openapiart.svg)](https://pypi.python.org/pypi/openapiart)\n[![license](https://img.shields.io/badge/license-MIT-green.svg)](https://en.wikipedia.org/wiki/MIT_License)\n\nThe `OpenAPIArt` (OpenAPI Artifact Generator) python package does the following:\n- pre-processes OpenAPI yaml files according to the [MODELGUIDE](../main/MODELGUIDE.md)\n- using the path keyword bundles all dependency OpenAPI yaml files into a single openapi.yaml file\n- post-processes any [MODELGUIDE](../main/MODELGUIDE.md) extensions\n- validates the bundled openapi.yaml file\n- generates a `.proto` file from the openapi file\n- optionally generates a static redocly documentation file \n- optionally generates a `python ux sdk` from the openapi file\n- optionally generates a `go ux sdk` from the openapi file\n\n## Getting started\nInstall the package\n```\npip install openapiart\n```\n\nGenerate artifacts from OpenAPI files\n```python\n\"\"\" \nThe following command will produce these artifacts:\n - ./artifacts/openapi.yaml\n - ./artifacts/openapi.json\n - ./artifacts/openapi.html\n - ./artifacts/sample.proto\n - ./artifacts/sample/__init__.py\n - ./artifacts/sample/sample.py\n - ./artifacts/sample/sample_pb2.py\n - ./artifacts/sample/sample_pb2_grpc.py\n - ./pkg/openapiart.go\n - ./pkg/go.mod\n - ./pkg/go.sum\n - ./pkg/sanity/sanity_grpc.pb.go\n - ./pkg/sanity/sanity.pb.go\n\"\"\"\nimport openapiart\n\n# bundle api files\n# validate the bundled file\n# generate the documentation file\nart = openapiart.OpenApiArt(\n api_files=[\n \"./openapiart/tests/api/info.yaml\",\n \"./openapiart/tests/common/common.yaml\",\n \"./openapiart/tests/api/api.yaml\",\n ],\n artifact_dir=\"./artifacts\",\n protobuf_name=\"sanity\",\n extension_prefix=\"sanity\",\n)\n\n# optionally generate a python ux sdk and python protobuf/grpc stubs\nart.GeneratePythonSdk(\n package_name=\"sanity\"\n)\n\n# optionally generate a go ux sdk and go protobuf/grpc stubs\nart.GenerateGoSdk(\n package_dir=\"github.com/open-traffic-generator/openapiart/pkg\", \n package_name=\"openapiart\"\n)\n```\n\n## Specifications\n> This repository is based on the [OpenAPI specification](\nhttps://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md) \nwhich is a standard, language-agnostic interface to RESTful APIs. \n\n> [Modeling guide specific to this package](../main/MODELGUIDE.md)\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The OpenAPI Artifact Generator Python Package",
"version": "0.3.21",
"project_urls": {
"Homepage": "https://github.com/open-traffic-generator/openapiart"
},
"split_keywords": [
"testing",
"openapi",
"artifact",
"generator"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6745543d64abc622bc17f7c57e904eed49b248e667e5aff13ef940bec6f2c949",
"md5": "47cbbe586d8bfd58f8e8873417e0b6c0",
"sha256": "e01d0c83e6a3f4033a883af175a9bfa5358e31d2222d2058299f2bc24551c4c7"
},
"downloads": -1,
"filename": "openapiart-0.3.21-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "47cbbe586d8bfd58f8e8873417e0b6c0",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": "<4,>=2.7",
"size": 140956,
"upload_time": "2024-09-06T07:55:55",
"upload_time_iso_8601": "2024-09-06T07:55:55.304703Z",
"url": "https://files.pythonhosted.org/packages/67/45/543d64abc622bc17f7c57e904eed49b248e667e5aff13ef940bec6f2c949/openapiart-0.3.21-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "af2fff69ae5e6cef28cf55b06210d22f3f8941d30d1b36df152d1d08d8801d34",
"md5": "1cffaf13e685596bc5a51e1a88e9e827",
"sha256": "93dae3c5e6a9d533286776aab024151aab7bcd33a6e2289c82745a3be62d8134"
},
"downloads": -1,
"filename": "openapiart-0.3.21.tar.gz",
"has_sig": false,
"md5_digest": "1cffaf13e685596bc5a51e1a88e9e827",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=2.7",
"size": 110283,
"upload_time": "2024-09-06T07:55:56",
"upload_time_iso_8601": "2024-09-06T07:55:56.583620Z",
"url": "https://files.pythonhosted.org/packages/af/2f/ff69ae5e6cef28cf55b06210d22f3f8941d30d1b36df152d1d08d8801d34/openapiart-0.3.21.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-06 07:55:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "open-traffic-generator",
"github_project": "openapiart",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "openapiart"
}