Skip to content
This repository was archived by the owner on Feb 10, 2023. It is now read-only.

Commit dd95338

Browse files
committed
use mergeAdhoc
1 parent 9cf0492 commit dd95338

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

Diff for: src/internal/OpenApiTools/components/ClientSchema.ts

+3
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ export const addSchema = (
257257
if (!schema) {
258258
return;
259259
}
260+
if (Guard.isAdhocAllOfSchema(schema)) {
261+
schema = ToTypeNode.mergeAdhoc(currentPoint, schema, context);
262+
}
260263
if (Guard.isAllOfSchema(schema)) {
261264
store.addStatement(targetPoint, {
262265
kind: "typeAlias",

Diff for: src/internal/OpenApiTools/components/ClientSchemas.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const generateNamespace = (
8282
}),
8383
});
8484
}
85-
const schema = InferredType.getInferredType(targetSchema);
85+
let schema = InferredType.getInferredType(targetSchema);
8686
const path = `${basePath}/${name}`;
8787
if (!schema) {
8888
// Schemaが特定できないためWarningを出力する
@@ -97,6 +97,9 @@ export const generateNamespace = (
9797
{ override: true },
9898
);
9999
}
100+
if (Guard.isAdhocAllOfSchema(schema)) {
101+
schema = ToTypeNode.mergeAdhoc(currentPoint, schema, context);
102+
}
100103
if (Guard.isAllOfSchema(schema)) {
101104
return store.addStatement(
102105
path,

Diff for: src/internal/OpenApiTools/components/Schema.ts

+3
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ export const addSchema = (
214214
if (!schema) {
215215
return;
216216
}
217+
if (Guard.isAdhocAllOfSchema(schema)) {
218+
schema = ToTypeNode.mergeAdhoc(currentPoint, schema, context);
219+
}
217220
if (Guard.isAllOfSchema(schema)) {
218221
store.addStatement(targetPoint, {
219222
kind: "typeAlias",

Diff for: src/internal/OpenApiTools/components/Schemas.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const generateNamespace = (
7979
}),
8080
});
8181
}
82-
const schema = InferredType.getInferredType(targetSchema);
82+
let schema = InferredType.getInferredType(targetSchema);
8383
const path = `${basePath}/${name}`;
8484
if (!schema) {
8585
// Schemaが特定できないためWarningを出力する
@@ -94,6 +94,9 @@ export const generateNamespace = (
9494
{ override: true },
9595
);
9696
}
97+
if (Guard.isAdhocAllOfSchema(schema)) {
98+
schema = ToTypeNode.mergeAdhoc(currentPoint, schema, context);
99+
}
97100
if (Guard.isAllOfSchema(schema)) {
98101
return store.addStatement(
99102
path,

0 commit comments

Comments
 (0)