forked from starkware-libs/starknet-specs
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvalidate.js
More file actions
executable file
·34 lines (26 loc) · 727 Bytes
/
validate.js
File metadata and controls
executable file
·34 lines (26 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env node
// const { types } = require("@open-rpc/meta-schema");
const { parseOpenRPCDocument, validateOpenRPCDocument } = require("@open-rpc/schema-utils-js");
async function runValidation(filename) {
try {
let doc = await parseOpenRPCDocument(filename);
const errors = validateOpenRPCDocument(doc);
if (errors === true) {
console.log("Ok!")
}
else {
console.error(errors.name)
console.error(errors.message)
}
}
catch (exn) {
console.error(exn && exn.message)
}
}
////
let args = process.argv.slice(2);
if (args.length > 0) {
runValidation(args[0]);
}
else
console.error("Missing filename");