Skip to content

Commit 4cff1a1

Browse files
committed
fix
1 parent 8c590a3 commit 4cff1a1

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tools/proto-convert/src/GlobalParamWrapper.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export class GlobalParameterConsolidator {
1414
*/
1515
consolidate(): OpenAPIV3.Document {
1616
this.createGlobalParamsSchema();
17+
this.createGlobalParamsParameter();
1718
this.replaceGlobalParamsInPaths();
1819
return this.root;
1920
}
@@ -63,6 +64,26 @@ export class GlobalParameterConsolidator {
6364
(this.root.components.schemas as any).GlobalParams = globalParamsSchema;
6465
}
6566

67+
private createGlobalParamsParameter(): void {
68+
if (!this.root.components) {
69+
this.root.components = {};
70+
}
71+
if (!this.root.components.parameters) {
72+
this.root.components.parameters = {};
73+
}
74+
75+
const globalParamsParam: any = {
76+
name: 'globalParams',
77+
in: 'query',
78+
description: 'Global query parameters',
79+
schema: {
80+
$ref: '#/components/schemas/GlobalParams',
81+
}
82+
};
83+
84+
(this.root.components.parameters as any).globalParams = globalParamsParam;
85+
}
86+
6687
private replaceGlobalParamsInPaths(): void {
6788
if (!this.root.paths) {
6889
return;

0 commit comments

Comments
 (0)