linter-swagger-improved

Lint Swagger files on save, using swagger-parser

TonyFNZ

2,204

3

0.2.2

MIT

GitHub

This package provides the following services:

Update: March 20th 2017
The improved error handler from within this project has now been merged into the main linter-swagger project. This project will be kept here for reference, but I recommend everyone switch to using the linter-swagger project where this functionality will be maintained from now on.

linter-swagger-improved

apm apm

An improved version of the linter-swagger plugin with better identification of errors within your swagger files.

This plugin for Linter will lint Swagger 2.0 specifications, both JSON and YAML using swagger-parser node package.

Linting Examples

Debugging Swagger spec errors has always been a frustrating experience, with the error messages given seemingly random and arbitrary. Here are a few examples of how this plugin improves things.

Invalid Types

swagger: "2.0"
info:
  title: "Sample 1"
  version: "1.0.0"
paths:
  /todos:
    get:
      description: "Returns all todo items"
      responses:
        200:
          description: "A list of todo items"
          schema:
            type: array
            items:
              type: object
              properties:
                id:
                  type: strin
                  format: uuid
                name:
                  type: string
Now Sample 1 Errors After
Before Sample 1 Errors Before

Invalid Properties

swagger: "2.0"
info:
  title: "Sample 2"
  version: "1.0.0"
paths:
  /todos:
    get:
      description: "Returns all todo items"
      responses:
        200:
          description: "A list of todo items"
          schema:
            type: array
            items:
              type: object
              properties:
                id:
                  type: string
                  forma: uuid
                name:
                  type: string
Now Sample 2 Errors After
Before Sample 2 Errors Before

Installation

Install linter-swagger-improved either in Atom's Preferences/Install Packages, or with apm on the command-line:

apm install linter-swagger-improved

This package will automatically install linter if that is missing.

License

MIT. More info in the LICENSE file