Skip to content

Commit

Permalink
fix (Typings): Remove optional member fields #42 TADA
Browse files Browse the repository at this point in the history
  • Loading branch information
cnguy committed Feb 4, 2019
1 parent bbee903 commit a16627f
Show file tree
Hide file tree
Showing 5 changed files with 5,210 additions and 487 deletions.
15 changes: 15 additions & 0 deletions _scripts/generate_ts_from_swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@ import request from 'request'
const sw2dts = require('sw2dts')
import fs from 'fs'
import path from 'path'
import yaml from 'js-yaml'

import SWAGGER_URL from './swagger_url'

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

// Remove this later
try {
const config = yaml.safeLoad(fs.readFileSync('./_scripts/swaggerspec-2.0.yml', 'utf8'));
const indentedJson = JSON.stringify(config, null, 4);
sw2dts.convert(JSON.parse(indentedJson)).then(data => {
fs.writeFileSync(TS_FILE_PATH, data)
console.log('done')
})
} catch (e) {
console.log(e);
}

/*
request(SWAGGER_URL, (err, res) => {
if (res) {
sw2dts.convert(JSON.parse(res.body)).then(data => {
Expand All @@ -15,3 +29,4 @@ request(SWAGGER_URL, (err, res) => {
})
}
})
*/
Loading

0 comments on commit a16627f

Please sign in to comment.