| title | openapi2http Converter | |
|---|---|---|
| description | Convert OpenAPI/Swagger specifications to REST CLI request files. | |
| tags |
|
Convert OpenAPI/Swagger specifications to REST CLI request files.
restcli openapi2http spec.yamlOr JSON:
restcli openapi2http swagger.jsonrestcli openapi2http spec.yaml -o requests/Creates request files in target directory.
Short: -o
restcli openapi2http spec.yaml --organize-by tagsOptions:
tags: Group by OpenAPI tagspaths: Group by path structureflat: All files in output directory
Default: flat
restcli openapi2http spec.yaml -f yamlOptions: http, yaml, json, jsonc
Default: http
Short: -f
Input OpenAPI spec:
openapi: 3.0.0
paths:
/users:
get:
summary: List users
operationId: listUsers
/users/{id}:
get:
summary: Get user
operationId: getUser
parameters:
- name: id
in: path
required: trueCommand:
restcli openapi2http api.yaml -o requests/Output files:
requests/listUsers.httprequests/getUser.http
OpenAPI spec with tags:
openapi: 3.0.0
paths:
/users:
get:
tags: [Users]
summary: List users
/posts:
get:
tags: [Posts]
summary: List postsCommand:
restcli openapi2http api.yaml --organize-by tags -o requests/Output structure:
requests/
├── Users/
│ └── listUsers.http
└── Posts/
└── listPosts.http
Command:
restcli openapi2http api.yaml --organize-by paths -o requests/Output structure:
requests/
├── users/
│ ├── list.http
│ └── get.http
└── posts/
└── list.http
restcli openapi2http spec.yaml -f yaml -o requests/Generated file:
name: List Users
method: GET
url: "{{baseUrl}}/users"
documentation:
description: "List all users"
tags:
- Users
responses:
- code: 200
description: "Success"
contentType: "application/json"restcli openapi2http spec.json -f json -o requests/Generated file:
{
"name": "List Users",
"method": "GET",
"url": "{{baseUrl}}/users",
"documentation": {
"description": "List all users",
"tags": ["Users"],
"responses": [
{
"code": 200,
"description": "Success",
"contentType": "application/json"
}
]
}
}Converter creates {{baseUrl}} variable:
GET {{baseUrl}}/users
Set in profile:
{
"variables": {
"baseUrl": "https://api.example.com"
}
}/users/{id}:
get:
parameters:
- name: id
in: pathGenerates:
GET {{baseUrl}}/users/{{id}}
/users:
get:
parameters:
- name: limit
in: query
- name: offset
in: queryGenerates:
GET {{baseUrl}}/users?limit={{limit}}&offset={{offset}}
/users:
post:
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: string
email:
type: stringGenerates:
POST {{baseUrl}}/users
Content-Type: application/json
{
"name": "{{name}}",
"email": "{{email}}"
}
/users:
get:
parameters:
- name: Authorization
in: header
required: trueGenerates:
GET {{baseUrl}}/users
Authorization: {{Authorization}}
Full documentation embedded in request files:
documentation:
description: "Create a new user"
tags:
- Users
parameters:
- name: name
type: string
required: true
description: "User's full name"
example: "John Doe"
- name: email
type: string
required: true
description: "User's email address"
example: "john@example.com"
responses:
- code: 201
description: "User created successfully"
contentType: "application/json"
example: |
{
"id": 1,
"name": "John Doe",
"email": "john@example.com"
}
- code: 400
description: "Invalid input"restcli openapi2http api.yaml --organize-by tags -o requests/Create .profiles.json:
[
{
"name": "Dev",
"variables": {
"baseUrl": "https://dev.api.example.com"
}
},
{
"name": "Prod",
"variables": {
"baseUrl": "https://api.example.com"
}
}
]- Complex schemas may need manual adjustment
- Authentication configuration not auto-generated
- Some OpenAPI features unsupported
- Generated examples use placeholder values