Convert OpenApi Specifications and Postman collections to .http files in Neovim.
This is just a wrapper around kulala-fmt.
kulala-fmtinstalled.
{
"bosvik/http-convert.nvim"
cmd = { "ConvertFromOpenApi", "ConvertFromPostman" },
opts = {},
}kulala-fmt is an opinionated .http and .rest files linter and formatter by mistweaverco. It can be installed either via npm or via mason.
npm install -g @mistweaverco/kulala-fmt{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.registries = opts.registries or {}
table.insert(opts.registries, "github:mistweaverco/zana-registry")
opts.ensure_installed = opts.ensure_installed or {}
table.insert(opts.ensure_installed, "kulala-fmt")
end,
}Depending on how kulala-fmt is installed it may be necessary to adjust the path.
{
"bosvik/http-convert.nvim"
cmd = { "ConvertFromOpenApi", "ConvertFromPostman" },
opts = {
formatter_path = vim.fs.joinpath(vim.fn.stdpath("data"), "mason", "bin", "kulala-fmt"),
},
}Open an OpenApi specification or a Postman collection (json or yaml) and run the command :ConvertFromOpenApi or :ConvertFromPostman
| Function | Description |
|---|---|
| ConvertFromOpenApi | Convert OpenApi spec |
| ConvertFromPostman | Convert a Postman collection |
You can also setup kulala-fmt with conform:
{
"stevearc/conform.nvim",
opts = {
formatters = {
kulala = {
command = "kulala-fmt",
args = { "format", "$FILENAME" },
stdin = false,
},
},
formatters_by_ft = {
http = { "kulala" },
},
},
}