Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function generateTypingsForApi(file) {
const swagger = JSON.parse(fs.readFileSync(file, 'UTF-8'))
const definitions = CodeGen.getTypescriptCode({
className: 'SauceLabs',
swagger,
template: {
class: fs.readFileSync('./scripts/class-definitions.mustache', 'utf-8'),
method: fs.readFileSync('./scripts/method.mustache', 'utf-8'),
}
})
const methods = CodeGen.getTypescriptCode({
className: 'SauceLabs',
swagger,
template: {
class: fs.readFileSync('./scripts/class-methods.mustache', 'utf-8'),
method: fs.readFileSync('./scripts/method.mustache', 'utf-8')
}
})
return {
defintions: definitions
.replace(/~~~(.*)~~~/g, (_, group) => changeCase.camel(group)),
methods: methods
.replace(/~~~(.*)~~~/g, (_, group) => changeCase.camel(group))
}
}
function generateTypingsForApi(file) {
const swagger = JSON.parse(fs.readFileSync(file, 'UTF-8'))
const definitions = CodeGen.getTypescriptCode({
className: 'SauceLabs',
swagger,
template: {
class: fs.readFileSync('./scripts/class-definitions.mustache', 'utf-8'),
method: fs.readFileSync('./scripts/method.mustache', 'utf-8'),
}
})
const methods = CodeGen.getTypescriptCode({
className: 'SauceLabs',
swagger,
template: {
class: fs.readFileSync('./scripts/class-methods.mustache', 'utf-8'),
method: fs.readFileSync('./scripts/method.mustache', 'utf-8')
}
})