Skip to content

Commit 123e100

Browse files
author
Tyler Waters
committed
Generate files first, then write them out
1 parent fb54625 commit 123e100

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/generator.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const generateOperationFile = (config, operation, operation_name) => new Promise
126126
* @param {Object} config Configuration options
127127
* @returns {Promise}
128128
*/
129-
const generateOperationFiles = config => new Promise((resolve, reject) => {
129+
const generateOperationFiles = config => {
130130
const files = {};
131131
_.each(config.data.openapi.paths, (path, path_name) => {
132132
const operation_name = path.endpointName;
@@ -142,11 +142,12 @@ const generateOperationFiles = config => new Promise((resolve, reject) => {
142142
subresource: (path_name.substring(operation_name.length+1) || '/').replace(/}/g, '').replace(/{/g, ':')
143143
});
144144

145-
Promise.all(
146-
_.map(files, (operation, operation_name) => generateOperationFile(config, operation, operation_name))
147-
).then(resolve).catch(reject);
148145
});
149-
});
146+
147+
return Promise.all(
148+
_.map(files, (operation, operation_name) => generateOperationFile(config, operation, operation_name))
149+
);
150+
};
150151

151152
/**
152153
* Generates the directory structure.

0 commit comments

Comments
 (0)