diff --git a/tools/src/merger/OpenApiMerger.ts b/tools/src/merger/OpenApiMerger.ts index b1d8e9d81..57d80f8a2 100644 --- a/tools/src/merger/OpenApiMerger.ts +++ b/tools/src/merger/OpenApiMerger.ts @@ -54,6 +54,7 @@ export default class OpenApiMerger { this.#merge_namespaces() this.#sort_spec_keys() this.#add_defaults() + this.#fix_refs() this.#generate_global_params() this.#generate_superseded_ops() this._merged = true @@ -135,6 +136,21 @@ export default class OpenApiMerger { }) } + #fix_refs(obj: any = this._spec.components): void { + if (obj?.$ref !== undefined) { + if (obj?.description !== undefined) { + delete obj?.description + } + } + + for (const key in obj) { + var item = obj[key] + if (_.isObject(item) || _.isArray(item)) { + this.#fix_refs(item) + } + } + } + #add_defaults(): void { // Add default descriptions Object.entries(this._spec.components.responses as Document).forEach(([_path, response_item]) => {