diff --git a/packages/core/src/getters/combine.ts b/packages/core/src/getters/combine.ts index 3d1462625..c937e1bfb 100644 --- a/packages/core/src/getters/combine.ts +++ b/packages/core/src/getters/combine.ts @@ -178,10 +178,6 @@ export const combineSchemas = ({ return { value: `typeof ${pascal(name)}[keyof typeof ${pascal(name)}] ${nullable}`, imports: [ - ...resolvedData.imports.map((toImport) => ({ - ...toImport, - values: true, - })), { name: pascal(name), }, @@ -189,7 +185,10 @@ export const combineSchemas = ({ schemas: [ ...resolvedData.schemas, { - imports: [], + imports: resolvedData.imports.map((toImport) => ({ + ...toImport, + values: true, + })), model: newEnum, name: pascal(name), }, diff --git a/tests/specifications/any-of.yaml b/tests/specifications/any-of.yaml index 62b47daf5..3ef725fe4 100644 --- a/tests/specifications/any-of.yaml +++ b/tests/specifications/any-of.yaml @@ -14,9 +14,14 @@ paths: in: query schema: anyOf: - - type: string - enum: ['A'] + - $ref: '#/components/schemas/A' - type: string enum: ['B'] - type: string enum: ['C'] +components: + schemas: + A: + type: string + enum: + - A