Skip to content

Commit

Permalink
Remove descriptions next to refs.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Oct 30, 2024
1 parent b9b4f4e commit 5e65b0a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tools/src/merger/OpenApiMerger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]) => {
Expand Down

0 comments on commit 5e65b0a

Please sign in to comment.