Metadata-Version: 2.4
Name: openapi_downgrade
Version: 0.1.8
Summary: Convert OpenAPI 3.1.x specifications to 3.0.x while preserving logic
Author: Rajesh Roy
Author-email: Rajesh Rou <rajeshroy362000@gmail.com>
License: MIT License
        
        Copyright (c) [2025] [Rajesh Roy]
        
        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/RajeshRoy4426/openapi_downgrade_3_0
Project-URL: Repository, https://github.com/RajeshRoy4426/openapi_downgrade_3_0
Project-URL: Issues, https://github.com/RajeshRoy4426/openapi_downgrade_3_0/issues
Keywords: openapi,spec,converter,swagger,openapi3.1,cli,openapi3.0
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer
Requires-Dist: requests
Requires-Dist: pyyaml
Requires-Dist: jsonschema>=4.19.0
Dynamic: license-file

# OpenAPI Downgrader

🔧 Convert OpenAPI 3.1.x specifications to 3.0.x — with logic preservation, support for `nullable`, `const`, advanced schema handling, and conditionals via `oneOf`.

## 🚀 Features

- ✅ Converts 3.1.x to 3.0.3 safely
- 🔁 Handles `nullable`, `const`, `if/then/else`, and `examples`
- ⚠️ Warns about unsupported or dropped keywords
- 📦 Ready to use as Python library or CLI

## 📦 Installation

You can install the tool from PyPI:

```bash
pip install openapi-downgrade
```

Or, for development, you can clone the repository and install it in editable mode:

```bash
git clone https://github.com/RajeshRoy4426/openapi_downgrade_3_0.git
cd openapi_downgrade_3_0
pip install -e .
```

## Usage

The command-line interface allows you to convert an OpenAPI specification from a file or a URL.

### Command

```bash
openapi_downgrade <input_path_or_url> <output_path>
```

### Arguments

-   `<input_path_or_url>`: The path to your local OpenAPI 3.1.x file or a URL to a raw spec.
-   `<output_path>`: The file path where the converted 3.0.x spec will be saved.

### Example

```bash
openapi_downgrade https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/petstore.json petstore_v3.0.json
```

This will download the `petstore.json` file, convert it to OpenAPI 3.0.x, and save the result as `petstore_v3.0.json` in your current directory.
