Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Lint OpenAPI specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dale Hui committed Jan 3, 2018
1 parent 8a6b352 commit 15a94ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This package will automatically install `linter` if that is missing.

## Usage

This package will automatically lint YAML and JSON files that have a `swagger` field
This package will automatically lint YAML and JSON files that have a `swagger` or `openapi` field
with a version number value, in accordance to the [Swagger spec](http://swagger.io/specification/).

## License
Expand Down
2 changes: 1 addition & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let populateRangesForErrors;
const idleCallbacks = new Set();

function canValidate(text) {
return text.length > 8 && /"?swagger"?\s*:\s*['"]\d+\.\d+['"]/g.test(text);
return text.length > 8 && /"?(swagger|openapi)"?\s*:\s*['"]\d+\.\d+(.\d+)?['"]/g.test(text);
}

function errorsToLinterMessages(err, path, text) {
Expand Down

0 comments on commit 15a94ad

Please sign in to comment.