OpenAPI extension for Visual Studio Code
A Visual Studio Code extension with rich support for the OpenAPI (aka Swagger) language (v2 and v3 in JSON format), including features such as IntelliSense, linting, schema enforcement, code navigation, definition links, snippets, and more!
Open any JSON file that contains OpenAPI v2 or OpenAPI v3 definition in VS Code. The plugin should automatically detect that this is an OpenAPI file. When it does, the OpenAPI icon gets displayed in the left-hand panel.
- Open an OpenAPI file.
- Click the OpenAPI button at the left-hand pane to switch to the OpenAPI explorer view.
- Expand elements, click the elements to which you want to navigate in the editor.
Add elements from OpenAPI explorer
In the left-hand OpenAPI explorer pane, click the ... menu in the section where you want to add the element and pick the corresponding item from the menu.
As you start typing OpenAPI elements and their values, context-relevant options get displayed in the intellisense menu. Just type double-quote (") to get it going.
Go to definition
- Ctrl-click a reference OR
- Right-click a reference and click "Go to Definition" on the shortcut menu
Create new OpenAPI files
- Press Ctrl-Shift-P on Windows or Cmd-Shift-P on a Mac.
- In the command prompt, start typing
new openapiand then click the corresponding command to get v2 or v3 file created.
- The template file gets created. Use the OpenAPI explorer pane to populate it with new paths and other elements.
Submit your issues, questions, and feature requests to the GitHub project Issues.