Skip to content

Commit

Permalink
fix(): fallback to the original behavior when no aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Oct 21, 2021
1 parent af85262 commit c107ca3
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions lib/swagger-explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,25 +183,42 @@ export class SwaggerExplorer {
}, {})
);

return methodMetadata.root.map((endpointMetadata: DenormalizedDoc) => {
endpointMetadata = {
...methodMetadata,
root: endpointMetadata as any
};
const mergedMethodMetadata = this.mergeMetadata(
globalMetadata,
omitBy(endpointMetadata, isEmpty)
);
return this.migrateOperationSchema(
if (Array.isArray(methodMetadata.root)) {
return methodMetadata.root.map((endpointMetadata: DenormalizedDoc) => {
endpointMetadata = {
...methodMetadata,
root: endpointMetadata as any
};
const mergedMethodMetadata = this.mergeMetadata(
globalMetadata,
omitBy(endpointMetadata, isEmpty)
);
return this.migrateOperationSchema(
{
responses: {},
...omit(globalMetadata, 'chunks'),
...mergedMethodMetadata
},
prototype,
targetCallback
);
});
}
const mergedMethodMetadata = this.mergeMetadata(
globalMetadata,
omitBy(methodMetadata, isEmpty)
);
return [
this.migrateOperationSchema(
{
responses: {},
...omit(globalMetadata, 'chunks'),
...mergedMethodMetadata
},
prototype,
targetCallback
);
});
)
];
});

return flatten(denormalizedPaths).filter((path) => path.root?.path);
Expand Down

0 comments on commit c107ca3

Please sign in to comment.