Skip to content

Commit a16627f

Browse files
committed
fix (Typings): Remove optional member fields #42 TADA
1 parent bbee903 commit a16627f

File tree

5 files changed

+5210
-487
lines changed

5 files changed

+5210
-487
lines changed

_scripts/generate_ts_from_swagger.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,25 @@ import request from 'request'
22
const sw2dts = require('sw2dts')
33
import fs from 'fs'
44
import path from 'path'
5+
import yaml from 'js-yaml'
56

67
import SWAGGER_URL from './swagger_url'
78

89
const TS_FILE_PATH = path.join(__dirname, '..', 'typings', 'dtos.ts')
910

11+
// Remove this later
12+
try {
13+
const config = yaml.safeLoad(fs.readFileSync('./_scripts/swaggerspec-2.0.yml', 'utf8'));
14+
const indentedJson = JSON.stringify(config, null, 4);
15+
sw2dts.convert(JSON.parse(indentedJson)).then(data => {
16+
fs.writeFileSync(TS_FILE_PATH, data)
17+
console.log('done')
18+
})
19+
} catch (e) {
20+
console.log(e);
21+
}
22+
23+
/*
1024
request(SWAGGER_URL, (err, res) => {
1125
if (res) {
1226
sw2dts.convert(JSON.parse(res.body)).then(data => {
@@ -15,3 +29,4 @@ request(SWAGGER_URL, (err, res) => {
1529
})
1630
}
1731
})
32+
*/

0 commit comments

Comments
 (0)