Metadata-Version: 2.4
Name: openapi3-parser
Version: 1.1.22
Summary: OpenAPI v3 parser
Author-email: Artem Manchenkov <artem@manchenkoff.me>
License: MIT License
        
        Copyright (c) 2020 Artyom Manchenkov
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: homepage, https://github.com/manchenkoff/openapi3-parser
Project-URL: source, https://github.com/manchenkoff/openapi3-parser
Keywords: swagger,python,swagger-parser,openapi3-parser,parser,openapi3,swagger-api
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: openapi-spec-validator>=0.7.2
Requires-Dist: prance>=23.6.21.0

# OpenAPI Parser

[![PyPI - Version](https://img.shields.io/pypi/v/openapi3-parser)](https://pypi.org/project/openapi3-parser/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/openapi3-parser)](https://clickpy.clickhouse.com/dashboard/openapi3-parser)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/openapi3-parser)](https://pypi.org/project/openapi3-parser/)
[![PyPI - Format](https://img.shields.io/pypi/format/openapi3-parser)](https://pypi.org/project/openapi3-parser/)
[![PyPI - License](https://img.shields.io/pypi/l/openapi3-parser)](license.txt)

A simple package to parse your OpenAPI 3 documents into Python object to work with.

Supported versions:

| Version | Status         |
| ------- | -------------- |
| 2.0     | Deprecated     |
| 3.0     | **Supported**  |
| 3.1     | In development |

## How to install

To install package run the following command

```
pip install openapi3-parser
```

## How to use

Example of parser usage

```
>>> from openapi_parser import parse
>>> content = parse('swagger.yml')
>>> print(content)
```

Get application servers

```python
from openapi_parser import parse

specification = parse('data/swagger.yml')

print("Application servers")

for server in specification.servers:
    print(f"{server.description} - {server.url}")

# Output
#
# >> Application servers
# >> production - https://users.app
# >> staging - http://stage.users.app
# >> development - http://users.local
```

Get list of application URLs

```python
from openapi_parser import parse

specification = parse('tests/data/swagger.yml')

urls = [x.url for x in specification.paths]

print(urls)

# Output
#
# >> ['/users', '/users/{uuid}']
```

Get operation with supported HTTP methods

```python
from openapi_parser import parse

specification = parse('tests/data/swagger.yml')

for path in specification.paths:
    supported_methods = ','.join([x.method.value for x in path.operations])

    print(f"Operation: {path.url}, methods: {supported_methods}")

# Output
#
# >> Operation: /users, methods: get,post
# >> Operation: /users/{uuid}, methods: get,put
```
