Skip to content

Commit 20cb8bb

Browse files
committed
More skeletons
1 parent d7a0851 commit 20cb8bb

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

scripts/schema-convert.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env node
2+
3+
'use strict';
4+
5+
const fs = require('fs');
6+
const yaml = require('yaml');
7+
8+
function convert(filename,date) {
9+
console.log(filename);
10+
const s = fs.readFileSync(filename,'utf8');
11+
let obj;
12+
try {
13+
obj = yaml.parse(s, {prettyErrors: true});
14+
//TODO: replace last segment in $id, id, and $ref with date
15+
console.log(JSON.stringify(obj,null,2));
16+
}
17+
catch (ex) {
18+
console.warn(' ',ex.message);
19+
process.exitCode = 1;
20+
}
21+
}
22+
23+
if (process.argv.length<4) {
24+
console.warn('Usage: convert-schema.js file.yaml YYYYMMDD');
25+
}
26+
else {
27+
convert(process.argv[2], process.argv[3]);
28+
}
29+

scripts/schema-publish.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ for filename in schemas/v3*/schema.yaml ; do
1313
echo $filename $lastCommitDate $version
1414
#TODO:
1515
# - generate JSON file "deploy/oas/$version/schema/$lastCommitDate" from schema.yaml
16+
# node scripts/schema-convert.js $filename $lastCommitDate > deploy/oas/$version/schema/$lastCommitDate.json
1617
# - if schema-base.yaml exists, generate JSON file "deploy/oas/$version/schema-base/$lastCommitDate" from schema-base.yaml
18+
# node scripts/schema-convert.js ... $lastCommitDate > deploy/oas/$version/schema-base/$lastCommitDate.json
1719
done

0 commit comments

Comments
 (0)