mirror of https://github.com/zulip/zulip.git
check-openapi: Restore functionality after OpenAPI definitions moved.
Commit 35577a1f66
(#9406) moved the
OpenAPI definitions to zerver/openapi, and this script was not
updated, so it has been validating nothing for two years.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
7bbbc46aad
commit
9620611ec9
|
@ -38,6 +38,7 @@
|
|||
"jquery": "^3.4.1",
|
||||
"jquery-caret-plugin": "^1.5.2",
|
||||
"jquery-validation": "^1.19.0",
|
||||
"js-yaml": "^3.13.1",
|
||||
"katex": "^0.11.1",
|
||||
"mini-css-extract-plugin": "^0.9.0",
|
||||
"moment": "^2.24.0",
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs');
|
||||
const jsyaml = require('js-yaml');
|
||||
const SwaggerParser = require('swagger-parser');
|
||||
|
||||
async function validate_swagger(file) {
|
||||
|
@ -13,12 +15,13 @@ async function validate_swagger(file) {
|
|||
}
|
||||
}
|
||||
|
||||
(async () => {
|
||||
// Iterate through the changed files, passed in the arguments.
|
||||
// The two first arguments are the call to the Node interpreter and this
|
||||
// script, hence the starting point at 2.
|
||||
for (const file of process.argv.slice(2)) {
|
||||
// Run the validator only for YAML files inside static/swagger
|
||||
if (file.startsWith('static/swagger')) {
|
||||
validate_swagger(file);
|
||||
if (jsyaml.safeLoad(await fs.promises.readFile(file, 'utf8')).openapi !== undefined) {
|
||||
await validate_swagger(file);
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue