Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/farhadrezvani/http-generator
Generate .http files from OpenAPI specifications
https://github.com/farhadrezvani/http-generator
openapi openapi-specification openapi3 rest-client swagger
Last synced: about 1 month ago
JSON representation
Generate .http files from OpenAPI specifications
- Host: GitHub
- URL: https://github.com/farhadrezvani/http-generator
- Owner: farhadrezvani
- License: mit
- Created: 2024-06-16T08:38:48.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-13T12:22:51.000Z (4 months ago)
- Last Synced: 2024-10-01T06:44:34.544Z (about 2 months ago)
- Topics: openapi, openapi-specification, openapi3, rest-client, swagger
- Language: TypeScript
- Homepage:
- Size: 85.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# http-generator
Generate `.http` files from OpenAPI specifications
## Features
- Generate HTTP file(s) either as
- A single file containing all requests
- A file per request- Supports OpenAPI v2 and v3
- JSON and YAML formats
- Schema Validation- Include authorization headers
- Include summaries and descriptions
- Variables for route parameters
- Specify base-url for convenient environment switching## Installation
Install in your project folder:
```bash
npm i http-generator -D
# Using yarn
yarn add http-generator --dev
# Using pnpm
pnpm add http-generator -D
```## Usage
Run http-generator with the appropriate options:
```bash
Usage: http-generator [options]Generate .http files from OpenAPI specifications
Options:
-i, --input OpenAPI specifications file or URL
-o, --output Output directory or HTTP file
-b, --base-url Base URL of the API
-t, --token Authorization token
-s, --skip-validation Skip validation of OpenAPI Specification (default: false)
-v, --version Display version number
-h, --help Display this message
```## Configuration File
You can also use `http-generator` using file configurations or in a property inside your package.json, and you can even use TypeScript and have type-safety while you are using it.
You can use any of these files:
- `httpgen.config.ts`
- `httpgen.config.js`
- `httpgen.config.cjs`
- `httpgen` property in your `package.json`Basic Configuration:
```js
import { defineConfig } from "http-generator";export default defineConfig({
input: "schema.json",
output: "output.http",
baseUrl: "https://example.com",
skipValidation: false,
token: "Bearer Token",
});
```## Contributing
Contributions are welcome! Please submit issues or pull requests.
## License
Licensed under the MIT License. See the [LICENSE](LICENSE) file for details.