Skip to content

Commit b922196

Browse files
committed
fix: only output shards with paths
1 parent a597d5b commit b922196

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
output/
2+
shard/
23
*.swp
34

45
# Logs

index.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,14 @@ function shard(obj, options) {
216216
for (let method in obj.paths[path]) {
217217
if (!options.method || options.method === method) {
218218
if (!obj.paths[path][method].operationId || options.operationid.length === 0 || (options.operationid && options.operationid.indexOf(obj.paths[path][method].operationId) >= 0)) {
219-
let key = obj.paths[path][method].operationId;
220-
if (!key) key = method+'-'+path;
221-
key = key.split('/').join('-').split('{').join('').split('}').join('');
222-
results.set(key, extract(obj, Object.assign({},options,{ path, method, operationid: obj.paths[path][method].operationId })));
223-
219+
let output = extract(obj, Object.assign({},options,{ path, method, operationid: obj.paths[path][method].operationId }));
220+
if (output.paths && Object.keys(output.paths).length > 0) {
221+
let key = obj.paths[path][method].operationId;
222+
if (!key) key = method+'-'+path;
223+
key = key.split('/').join('-').split('--').join('-').split('{').join('').split('}').join('');
224+
results.set(key, output);
225+
226+
}
224227
}
225228
}
226229
}

0 commit comments

Comments
 (0)