Skip to content

Commit

Permalink
fix(doc): add path summary coalesce support
Browse files Browse the repository at this point in the history
  • Loading branch information
etienne-bechara committed Jan 4, 2025
1 parent e738a34 commit 8e1e6d8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion source/doc/doc.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class DocModule {
const document = this.buildOpenApiObject(instance, builder);

this.coalesceSchemaTitles(document);
this.coalescePathSummaries(document);

if (servers?.length > 0) {
this.hasServers = true;
Expand Down Expand Up @@ -120,7 +121,21 @@ export class DocModule {
const { schemas } = components;

for (const key in schemas) {
schemas[key] = { ...schemas[key], title: key };
schemas[key]['title'] ||= key;
}
}

/**
* Add missing summaries to path schemas.
* @param document
*/
private static coalescePathSummaries(document: OpenAPIObject): void {
const { paths } = document;

for (const path in paths) {
for (const method in paths[path]) {
paths[path][method].summary ||= paths[path][method].operationId;
}
}
}

Expand Down

0 comments on commit 8e1e6d8

Please sign in to comment.