Skip to content

armsnyder/openapi-language-server

Repository files navigation

OpenAPI Language Server

An OpenAPI language server for LSP compatible code editors.

⚠️ This is beta software. Many features are still missing. See Features below.

asciicast

Features

I created this language server because I manually edit OpenAPI/Swagger files, and I needed a quick way to jump between schema definitions and references.

I use yaml-language-server for validation and completion, so these features are not a priority for me right now.

Language Features

  • Jump to definition
  • Find references
  • Code completion
  • Diagnostics
  • Hover
  • Rename
  • Document symbols
  • Code actions

Other Features

  • YAML filetype support
  • JSON filetype support
  • VSCode extension

Installation

From GitHub Releases (Recommended)

Download the latest release from GitHub releases.

Using Go

go install github.com/armsnyder/openapi-language-server@latest

Usage

Neovim Configuration Example

Assuming you are using Neovim and have the installed openapi-language-server binary in your PATH, you can use the following Lua code in your Neovim configuration:

    vim.api.nvim_create_autocmd('FileType', {
      pattern = 'yaml',
      callback = function()
        vim.lsp.start {
          cmd = { 'openapi-language-server' },
          filetypes = { 'yaml' },
          root_dir = vim.fn.getcwd(),
        }
      end,
    })

This is just a basic working example. You will probably want to further customize the configuration to your needs.