Skip to content

Commit

Permalink
generateExpressServer
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepsinn committed Nov 18, 2019
1 parent 6bfd3d1 commit e9feaff
Show file tree
Hide file tree
Showing 3 changed files with 276 additions and 5 deletions.
23 changes: 19 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,20 +349,35 @@ function getSwaggerDownloadRequestOptions(language) {
requestOptions.body.options.artifactDescription = requestOptions.body.options.projectDescription = swaggerJson.info.description;
return requestOptions;
}
function downloadSdk(language) {
function downloadSdk(language){
const requestOptions = getSwaggerDownloadRequestOptions(language);
if(debug){getSwaggerConfigOptions(language);}
if(debug){
getSwaggerConfigOptions(language);
}
return rp(requestOptions)
.then(function (parsedBody) {
.then(function(parsedBody){
const downloadLink = parsedBody.link.replace('https', 'http');
return download(downloadLink)
.pipe(rename(getSdkNameForLanguage(language) + '.zip'))
.pipe(gulp.dest(sdksZippedPath));
})
.catch(function (err) {
.catch(function(err){
logError(err.error.message);
});
}
function generateExpressServer(){
const path = require('path');
const codegen = require('swagger-node-codegen');
const swagger = require('./swagger/swagger.json');
codegen.generate({
swagger,
target_dir: path.resolve(__dirname, './sdks-unzipped/'+getSdkNameForLanguage(language))
}).then(() => {
console.log('Done!');
}).catch(err => {
console.error(`Something went wrong: ${err.message}`);
});
}
function getSwaggerConfigOptions(language) {
const getOptionsRequestOptions = getRequestOptions(language);
getOptionsRequestOptions.method = "GET";
Expand Down
Loading

0 comments on commit e9feaff

Please sign in to comment.