Skip to content

Commit afc2448

Browse files
committed
feat: override usage+original schemas with onInit hook
1 parent ded58e7 commit afc2448

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.changeset/nine-buckets-study.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"swagger-typescript-api": patch
3+
---
4+
5+
added ability to override usageSchema and originalSchema after onInit hook and before all other operations

src/code-gen-process.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ export class CodeGenProcess {
112112
this.config.hooks.onInit(this.config, this) || this.config,
113113
);
114114

115+
if (this.config.swaggerSchema) {
116+
swagger.usageSchema = this.config.swaggerSchema;
117+
}
118+
if (this.config.originalSchema) {
119+
swagger.originalSchema = this.config.originalSchema;
120+
}
121+
115122
this.schemaComponentsMap.clear();
116123

117124
lodash.each(swagger.usageSchema.components, (component, componentName) =>

0 commit comments

Comments
 (0)