Skip to content

Commit 78354d5

Browse files
authored
Merge pull request ferdikoomen#1454 from kraenhansen/parameter-components
Parameter components
2 parents 3361658 + 80880e6 commit 78354d5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/openApi/v3/parser/getModels.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ export const getModels = (openApi: OpenApi): Model[] => {
1515
models.push(model);
1616
}
1717
}
18+
for (const definitionName in openApi.components.parameters) {
19+
if (openApi.components.parameters.hasOwnProperty(definitionName)) {
20+
const definition = openApi.components.parameters[definitionName];
21+
const definitionType = getType(definitionName);
22+
const schema = definition.schema;
23+
if (schema) {
24+
const model = getModel(openApi, schema, true, definitionType.base.replace(reservedWords, '_$1'));
25+
model.description = definition.description || null;
26+
model.deprecated = definition.deprecated;
27+
models.push(model);
28+
}
29+
}
30+
}
1831
}
1932
return models;
2033
};

test/__snapshots__/index.spec.ts.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4907,7 +4907,6 @@ export type SimpleInteger = number;
49074907
"
49084908
`;
49094909

4910-
exports[`v3 should generate: test/generated/v3/models/SimpleReference.ts 1`] = `
49114910
"/* istanbul ignore file */
49124911
/* tslint:disable */
49134912
/* eslint-disable */

0 commit comments

Comments
 (0)