Skip to content

bosvik/http-convert.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Http-Converter

Convert OpenApi Specifications and Postman collections to .http files in Neovim. This is just a wrapper around kulala-fmt.

⚡️Requirements

  • kulala-fmt installed.

📦 Installation

{
  "bosvik/http-convert.nvim"
  cmd = { "ConvertFromOpenApi", "ConvertFromPostman" },
  opts = {},
}

kulala-fmt

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

npm install -g @mistweaverco/kulala-fmt

Mason

{
  "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,
}

⚙ Configuration

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"),
  },
}

🚀 Usage

Open an OpenApi specification or a Postman collection (json or yaml) and run the command :ConvertFromOpenApi or :ConvertFromPostman

Commands

Function Description
ConvertFromOpenApi Convert OpenApi spec
ConvertFromPostman Convert a Postman collection

Bonus

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" },
      },
    },
  }

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages