Git Product home page Git Product logo

vscode-swagger's Introduction

Swagger Preview

This project contains an extension to VS Code, allowing you to preview a Swagger 2.0 document within the VS Code UI, much like you can do with markdown files.

The extension is implemented in TypeScript, in the file swaggerpreview/src/extension.ts. In response to edits to a Swagger JSON document, it parses the data and generates HTML that is then displayed in a preview window.

Installation

There is no installer for this plugin. Instead, you copy three files in place.

Under your VS Code home folder, create a 'swaggerpreview' folder under '.vscode/extensions'. The home folder is found under ~/ on Linux and OS X, under %USERPROFILE% on Windows. Then, create a folder swaggerpreview/out/src, copy the files from the out/src directory in this repo, and the package.json file into the top-level 'swaggerpreview' folder.

Restart VS Code, open a Swagger file, and press F1. This should pop open the command prompt. The command to look for is named 'Swagger Preview.' When selected, it should create a second window pane and display a rendering of the Swagger data as documentation-style HTML.

You may want to add a keybinding for the command. For example, I've been using this:

	{ "key": "ctrl+shift+q", "command": "extension.showSwaggerPreview" }

While editing the Swagger document, you will notice that the preview pane is updated as you type, but you cannot edit text in the preview document directly.

Scrolling one window or moving the caret does not scroll the other window.

Some section headers are marked with a triangle "arrow," which indicates that it is collapsable. For long documents, this may be a meaningful way of getting a better overview of the document. However, when the Swagger document is edited, the preview pane is completely redrawn, sending all collapsed/expanded sections back to their original state. Editing does not scroll the preview back to the top, so the preview window position is, fortunately, not changed on edits to the document.

Missing Features

Information from the securityDefinitions, security, tags, and externalDocs sections are not displayed.

vscode-swagger's People

Contributors

niklasgustafsson avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

dbollella

vscode-swagger's Issues

Test Issue

This is a test issue. No need to do anything.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.