OpenAPI Swagger Preview

OpenAPI (Swagger) Editor is an optional extension that can be added to your VS Code.

Setup

Install the OpenAPI (Swagger) Editor from Extensions (CTRL+SHIFT+X) and follow the instructions.

Environment

Change the server section of the OpenAPI definition of the service to use the host URL _http://localhost:7071/<openapi_name_in_lowercase>/{basePath}_.

In the BaaS Service Explorer node of an OpenAPI file, there is a context-menu option 'Set local Swagger server path".

The command inserts the correct URL in the OpenAPI file at the top of the servers section.

An import of an existing OpenAPI file also executes the command to ensure there is a correct local Swagger server path.

Test the Locally Running Service

  1. Start the 'Azurite Blob Service' accessible in the status bar.
  2. Start the 'Azurite Queue Service' accessible in the status bar.
  3. Start debugging or run the Service in Visual Studio Code from the 'Run and Debug' view container.
  4. Select the 'Swagger Preview' command on the OpenAPI definition for the Service.
  5. Expand the Swagger Preview section with the method to call:
    1. Press the 'Try it Out' button.
    2. Enter required parameters if any.
    3. Press the 'Execute' button.
    4. Wait for the response.