From 2aa1a454f5aab5f8734ae38e46f6b29a20ac9ff1 Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Wed, 8 Nov 2023 08:52:18 -0800 Subject: [PATCH] feat(api): import schemas in the types file as types (#815) --- packages/api/src/codegen/languages/typescript/index.ts | 2 +- packages/test-utils/sdks/alby/src/types.ts | 2 +- packages/test-utils/sdks/metrotransit/src/types.ts | 2 +- packages/test-utils/sdks/optional-payload/src/types.ts | 2 +- packages/test-utils/sdks/petstore/src/types.ts | 2 +- packages/test-utils/sdks/readme/src/types.ts | 2 +- packages/test-utils/sdks/response-title-quirks/src/types.ts | 2 +- packages/test-utils/sdks/simple/src/types.ts | 2 +- packages/test-utils/sdks/star-trek/src/types.ts | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/api/src/codegen/languages/typescript/index.ts b/packages/api/src/codegen/languages/typescript/index.ts index 029f2a45..06be2183 100644 --- a/packages/api/src/codegen/languages/typescript/index.ts +++ b/packages/api/src/codegen/languages/typescript/index.ts @@ -778,7 +778,7 @@ Generated at ${createdAt} sourceFile.addImportDeclarations([ { defaultImport: 'type { FromSchema }', moduleSpecifier: '@readme/api-core/types' }, - { defaultImport: '* as schemas', moduleSpecifier: './schemas.js' }, + { defaultImport: 'type * as schemas', moduleSpecifier: './schemas.js' }, ]); Array.from(new Map(Array.from(this.types.entries()).sort())).forEach(([typeName, typeExpression]) => { diff --git a/packages/test-utils/sdks/alby/src/types.ts b/packages/test-utils/sdks/alby/src/types.ts index 7e9e9e04..e951ca81 100644 --- a/packages/test-utils/sdks/alby/src/types.ts +++ b/packages/test-utils/sdks/alby/src/types.ts @@ -1,5 +1,5 @@ import type { FromSchema } from '@readme/api-core/types'; -import * as schemas from './schemas.js'; +import type * as schemas from './schemas.js'; export type AmqpExternalRulePatch = FromSchema; export type AmqpExternalRulePost = FromSchema; diff --git a/packages/test-utils/sdks/metrotransit/src/types.ts b/packages/test-utils/sdks/metrotransit/src/types.ts index 811045f8..4e5eec13 100644 --- a/packages/test-utils/sdks/metrotransit/src/types.ts +++ b/packages/test-utils/sdks/metrotransit/src/types.ts @@ -1,5 +1,5 @@ import type { FromSchema } from '@readme/api-core/types'; -import * as schemas from './schemas.js'; +import type * as schemas from './schemas.js'; export type Agency = FromSchema; export type AlertMessage = FromSchema; diff --git a/packages/test-utils/sdks/optional-payload/src/types.ts b/packages/test-utils/sdks/optional-payload/src/types.ts index b06f33ef..470718f3 100644 --- a/packages/test-utils/sdks/optional-payload/src/types.ts +++ b/packages/test-utils/sdks/optional-payload/src/types.ts @@ -1,5 +1,5 @@ import type { FromSchema } from '@readme/api-core/types'; -import * as schemas from './schemas.js'; +import type * as schemas from './schemas.js'; export type UpdatePetWithFormFormDataParam = FromSchema; export type UpdatePetWithFormMetadataParam = FromSchema; diff --git a/packages/test-utils/sdks/petstore/src/types.ts b/packages/test-utils/sdks/petstore/src/types.ts index 7c39b87e..53922340 100644 --- a/packages/test-utils/sdks/petstore/src/types.ts +++ b/packages/test-utils/sdks/petstore/src/types.ts @@ -1,5 +1,5 @@ import type { FromSchema } from '@readme/api-core/types'; -import * as schemas from './schemas.js'; +import type * as schemas from './schemas.js'; export type ApiResponse = FromSchema; export type Category = FromSchema; diff --git a/packages/test-utils/sdks/readme/src/types.ts b/packages/test-utils/sdks/readme/src/types.ts index 69bbd689..514d872d 100644 --- a/packages/test-utils/sdks/readme/src/types.ts +++ b/packages/test-utils/sdks/readme/src/types.ts @@ -1,5 +1,5 @@ import type { FromSchema } from '@readme/api-core/types'; -import * as schemas from './schemas.js'; +import type * as schemas from './schemas.js'; export type Apply = FromSchema; export type Category = FromSchema; diff --git a/packages/test-utils/sdks/response-title-quirks/src/types.ts b/packages/test-utils/sdks/response-title-quirks/src/types.ts index b62f8b14..7c750fff 100644 --- a/packages/test-utils/sdks/response-title-quirks/src/types.ts +++ b/packages/test-utils/sdks/response-title-quirks/src/types.ts @@ -1,5 +1,5 @@ import type { FromSchema } from '@readme/api-core/types'; -import * as schemas from './schemas.js'; +import type * as schemas from './schemas.js'; export type GetAnythingMetadataParam = FromSchema; export type GetAnythingResponse2XX = FromSchema; diff --git a/packages/test-utils/sdks/simple/src/types.ts b/packages/test-utils/sdks/simple/src/types.ts index dbe44884..42f22499 100644 --- a/packages/test-utils/sdks/simple/src/types.ts +++ b/packages/test-utils/sdks/simple/src/types.ts @@ -1,5 +1,5 @@ import type { FromSchema } from '@readme/api-core/types'; -import * as schemas from './schemas.js'; +import type * as schemas from './schemas.js'; export type Category = FromSchema; export type FindPetsByStatusMetadataParam = FromSchema; diff --git a/packages/test-utils/sdks/star-trek/src/types.ts b/packages/test-utils/sdks/star-trek/src/types.ts index fc5c86b0..07d11bb7 100644 --- a/packages/test-utils/sdks/star-trek/src/types.ts +++ b/packages/test-utils/sdks/star-trek/src/types.ts @@ -1,5 +1,5 @@ import type { FromSchema } from '@readme/api-core/types'; -import * as schemas from './schemas.js'; +import type * as schemas from './schemas.js'; export type AnimalBase = FromSchema; export type AnimalBaseResponse = FromSchema;