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": "^3.4.1",
|
||||||
"jquery-caret-plugin": "^1.5.2",
|
"jquery-caret-plugin": "^1.5.2",
|
||||||
"jquery-validation": "^1.19.0",
|
"jquery-validation": "^1.19.0",
|
||||||
|
"js-yaml": "^3.13.1",
|
||||||
"katex": "^0.11.1",
|
"katex": "^0.11.1",
|
||||||
"mini-css-extract-plugin": "^0.9.0",
|
"mini-css-extract-plugin": "^0.9.0",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const jsyaml = require('js-yaml');
|
||||||
const SwaggerParser = require('swagger-parser');
|
const SwaggerParser = require('swagger-parser');
|
||||||
|
|
||||||
async function validate_swagger(file) {
|
async function validate_swagger(file) {
|
||||||
|
@ -13,12 +15,13 @@ async function validate_swagger(file) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterate through the changed files, passed in the arguments.
|
(async () => {
|
||||||
// The two first arguments are the call to the Node interpreter and this
|
// Iterate through the changed files, passed in the arguments.
|
||||||
// script, hence the starting point at 2.
|
// The two first arguments are the call to the Node interpreter and this
|
||||||
for (const file of process.argv.slice(2)) {
|
// script, hence the starting point at 2.
|
||||||
// Run the validator only for YAML files inside static/swagger
|
for (const file of process.argv.slice(2)) {
|
||||||
if (file.startsWith('static/swagger')) {
|
if (jsyaml.safeLoad(await fs.promises.readFile(file, 'utf8')).openapi !== undefined) {
|
||||||
validate_swagger(file);
|
await validate_swagger(file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})();
|
||||||
|
|
Loading…
Reference in New Issue