sgstq / openapi-rest-client-generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenAPI to VSCode REST Client Generator

Upload Python Package Python check

This tool automatically generates .http files for the VSCode REST Client from an OpenAPI (Swagger) specification. It supports both local and remote (URL) OpenAPI JSON files.

image

Features

  • Fetch OpenAPI JSON from a URL or a local file.
  • Generate .http files compatible with the VSCode REST Client.
  • Handle path and query parameters, including enum options.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Python 3.x
  • requests library for Python (Install using pip install requests)

Usage

To use the OpenAPI to VSCode REST Client Generator, follow these steps:

  1. Clone or download this repository to your local machine.
  2. Install the required Python packages using pip install -r requirements.txt.
  3. Run the script using the following command:

The file can be loaded locally or pulled directly from an url e.g https://petstore.swagger.io/v2/swagger.json

python gen_openapi_rest.py <swagger-json-source> <output-http-file>

About


Languages

Language:Python 100.0%