From fb54625029fb3085961a8ec391bea35ee23f6a3b Mon Sep 17 00:00:00 2001 From: Tyler Waters Date: Wed, 21 Oct 2020 22:08:55 -0700 Subject: [PATCH 1/3] Remove superfluous resolve Fixes #46 --- lib/generator.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/generator.js b/lib/generator.js index e98e442..2477cbc 100644 --- a/lib/generator.js +++ b/lib/generator.js @@ -145,7 +145,6 @@ const generateOperationFiles = config => new Promise((resolve, reject) => { Promise.all( _.map(files, (operation, operation_name) => generateOperationFile(config, operation, operation_name)) ).then(resolve).catch(reject); - resolve(); }); }); From 123e1007a8696bc96af96c57f2c169715db4909f Mon Sep 17 00:00:00 2001 From: Tyler Waters Date: Wed, 21 Oct 2020 22:39:16 -0700 Subject: [PATCH 2/3] Generate files first, then write them out --- lib/generator.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/generator.js b/lib/generator.js index 2477cbc..0ad7ee2 100644 --- a/lib/generator.js +++ b/lib/generator.js @@ -126,7 +126,7 @@ const generateOperationFile = (config, operation, operation_name) => new Promise * @param {Object} config Configuration options * @returns {Promise} */ -const generateOperationFiles = config => new Promise((resolve, reject) => { +const generateOperationFiles = config => { const files = {}; _.each(config.data.openapi.paths, (path, path_name) => { const operation_name = path.endpointName; @@ -142,11 +142,12 @@ const generateOperationFiles = config => new Promise((resolve, reject) => { subresource: (path_name.substring(operation_name.length+1) || '/').replace(/}/g, '').replace(/{/g, ':') }); - Promise.all( - _.map(files, (operation, operation_name) => generateOperationFile(config, operation, operation_name)) - ).then(resolve).catch(reject); }); -}); + + return Promise.all( + _.map(files, (operation, operation_name) => generateOperationFile(config, operation, operation_name)) + ); +}; /** * Generates the directory structure. From fc30c84af35488faf276d0e211116d2118c8ed08 Mon Sep 17 00:00:00 2001 From: Tyler Waters Date: Wed, 21 Oct 2020 22:39:24 -0700 Subject: [PATCH 3/3] Add Tyler Waters to contributers --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index b87b113..d2c9d70 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,10 @@ { "name": "Richard Klose", "email": "richard.klose@gmail.com" + }, + { + "name": "Tyler Waters", + "email": "tyler.waters@gmail.com" } ], "homepage": "https://github.com/fmvilas/openapi3-generator",