-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
3,106 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ dist | |
bin/ | ||
.nyc_output/ | ||
coverage/ | ||
.spectral.json |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"extends": [["spectral:oas", "off"]], | ||
"formats": ["oas2", "oas3"], | ||
"functionsDir": "../functions", | ||
"rules": { | ||
"no-eval-in-markdown": true, | ||
"no-script-tags-in-markdown": true, | ||
"openapi-tags": true, | ||
"operation-description": true, | ||
"operation-tags": true, | ||
"operation-tag-defined": true, | ||
"path-keys-no-trailing-slash": true, | ||
"typed-enum": true, | ||
"oas2-api-host": true, | ||
"oas2-api-schemes": true, | ||
"oas2-host-trailing-slash": true, | ||
"oas2-valid-example": true, | ||
"oas2-valid-definition-example": true, | ||
"oas2-anyOf": true, | ||
"oas2-oneOf": true, | ||
"oas3-api-servers": true, | ||
"oas3-examples-value-or-externalValue": true, | ||
"oas3-server-trailing-slash": true, | ||
"oas3-valid-example": true, | ||
"oas3-valid-schema-example": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const MessageCarrier = require('../../plugins/utils/messageCarrier'); | ||
|
||
const parseResults = function(results) { | ||
const messages = new MessageCarrier(); | ||
|
||
if (results) { | ||
for (const validationResult of results) { | ||
if (validationResult) { | ||
const code = validationResult['code']; | ||
const severity = validationResult['severity']; | ||
const message = validationResult['message']; | ||
const path = validationResult['path']; | ||
|
||
if (code && severity != null && message && path) { | ||
if (code == 'parser') { | ||
// Spectral doesn't allow disabling parser rules, so don't include them | ||
// in the output for now | ||
continue; | ||
} | ||
// Our validator only supports warning/error level, so only include | ||
// those validation results (for now) | ||
if (severity == '1') { | ||
//warning | ||
messages.addMessage(path, message, 'warning'); | ||
} else if (severity == '0') { | ||
//error | ||
messages.addMessage(path, message, 'error'); | ||
} | ||
} else { | ||
console.error( | ||
'There was an error while parsing the spectral results: ', | ||
JSON.stringify(validationResult) | ||
); | ||
continue; | ||
} | ||
} | ||
} | ||
} | ||
return messages; | ||
}; | ||
|
||
module.exports = { | ||
parseResults | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.