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')
}
})
const fs = require('fs')
const path = require('path')
const changeCase = require('change-case')
const CodeGen = require('swagger-typescript-codegen').CodeGen
const prettier = require('prettier')
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: {