14
2879

OpenAPI editor on Visual Studio Code

Reading Time: 2 minutes

OpenAPI editor or Swagger editor can be as simple as editing a json or yaml file on your machine plain text. You can either start by copying the code from an existing file or to write it from scratch. However, it will really help to have an editor that can add in the boilerplate codes for you with a few clicks.

In this basic guide, we will use visual studio code OpenAPI Editor to help with the generation of boilerplate codes.

First, get a copy of visual studio code(VS code) install into your machine.

Once VS code finish installing and launch, go into the marketplace and search for OpenAPI Editor as shown below.

Create a new file by pressing Ctrl+Shift+P if you are on windows and Cmd+Shift+P if you are on mac. Type in “new OpenAPI” and select the format you want to use.

In this example, yaml file is chosen for editing.

Once the default file generate completes, click on the API logo displayed on the left side of VS code to launch the OpenAPI explorer view.

With the explorer view, it allows developers like us to add in the OpenAPI definitions boilerplate code with just some clicks.

Here we add user “get” and “post” endpoint to the definition.

The interface to add components, security, servers and the general options are the same.

Conclusion

OpenAPI editor really is a great tool and can help you when you forget the declaration syntax for certain definitions without the need to refer back to the main specification document.

Show Comments

No Responses Yet

Leave a Reply