-
Notifications
You must be signed in to change notification settings - Fork 0
Import
Convert OpenAPI, Swagger, or Postman specs into .http files.
:PosteImportOpenAPI- Select an OpenAPI 3.x spec file (JSON or YAML)
- Select an output directory
-
.httpfiles are generated with all endpoints, parameters, and schemas
:PosteImportSwaggerSame flow as OpenAPI import. Converts Swagger 2.0 to .http format.
:PosteImportPostmanConverts Postman Collection v2.1 JSON to .http files.
Imported specs generate .http files with:
-
@base_urldefinition at the top -
@vardefinitions for query, path, cookie, and form body parameters - Named request blocks for each endpoint
- Default values from the schema where available
Reference and execute requests across files.
Make request names from another file available:
import ./shared-vars.httpWith alias (namespace isolation):
import ./auth.http as authExecute a request from another file:
run #LoginRun with alias:
run #auth.GetTokenRun with variable overrides:
run #Login (@env=staging, @timeout=30)Run all requests in a file:
run ./setup.httpRun all with overrides:
run ./setup.http (@env=production)Overrides in run take the highest priority in the resolution chain:
run #CreateUser (@role=admin, @department=engineering)These override block-level, file-level, and env variables.
Imported files can themselves import other files. The resolution is recursive.
Target blocks with pre/post scripts are executed normally when run via run directive. client.global variables persist across the entire chain.
Import Lua variables into .http files. No external runtime needed — runs on Neovim's built-in LuaJIT.
Create a Lua file that returns a table:
-- variables.lua
local M = {}
M.an_int = 100
M.a_string = "hello"
M.a_float = 3.14
M.a_bool = true
M.person = { name = "Lex", age = 23, role = "admin" }
M.tags = { "rust", "lua", "neovim" }
M.config = { endpoint = "https://api.example.com", timeout = 5000 }
M.users = {
{ id = 1, name = "alice", email = "alice@test.com" },
{ id = 2, name = "bob", email = "bob@test.com" },
}
return Mimport ./variables.lua as m
@my_person = m.person
@first_tag = m.tags[1]
### Inline substitution
GET {{base_url}}/anything/{{m.an_int}}
X-Name: {{m.a_string}}
### Nested path
GET {{base_url}}/user/{{m.person.name}}
X-Age: {{m.person.age}}
### Array index
GET {{base_url}}/tag/{{m.tags[1]}}
### @var assignment (body expands via {{}})
@my_data = m.person
POST {{base_url}}/anything
Content-Type: application/json
{{my_data}}
### Direct alias in JSON body
POST {{base_url}}/anything
Content-Type: application/json
{
"name": "{{m.person.name}}",
"age": {{m.person.age}},
"tags": ["{{m.tags[1]}}", "{{m.tags[2]}}"],
"config": {{m.config}}
}| Pattern | Example | Result |
|---|---|---|
{{m.key}} |
{{m.an_int}} |
100 |
{{m.nested.key}} |
{{m.person.name}} |
"Lex" |
{{m.array[N]}} |
{{m.tags[1]}} |
"rust" |
{{m.deep.nested[N].key}} |
{{m.users[1].name}} |
"alice" |
@var = m.keypath |
@x = m.person |
@x = {"name":"Lex","age":23} |
{{var}} (via @var) |
{{my_data}} |
{"name":"Lex","age":23} |
- Array indexing uses Lua convention (1-based):
tags[1]is the first element - Lua module is loaded once per file path and cached
- No Node.js or external runtime required