Skip to content

Commit

Permalink
feat(api): import schemas in the types file as types (#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
erunion authored Nov 8, 2023
1 parent 590f372 commit 2aa1a45
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/api/src/codegen/languages/typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/alby/src/types.ts
Original file line number Diff line number Diff line change
@@ -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<typeof schemas.AmqpExternalRulePatch>;
export type AmqpExternalRulePost = FromSchema<typeof schemas.AmqpExternalRulePost>;
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/metrotransit/src/types.ts
Original file line number Diff line number Diff line change
@@ -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<typeof schemas.Agency>;
export type AlertMessage = FromSchema<typeof schemas.AlertMessage>;
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/optional-payload/src/types.ts
Original file line number Diff line number Diff line change
@@ -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<typeof schemas.UpdatePetWithForm.formData>;
export type UpdatePetWithFormMetadataParam = FromSchema<typeof schemas.UpdatePetWithForm.metadata>;
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/petstore/src/types.ts
Original file line number Diff line number Diff line change
@@ -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<typeof schemas.ApiResponse>;
export type Category = FromSchema<typeof schemas.Category>;
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/readme/src/types.ts
Original file line number Diff line number Diff line change
@@ -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<typeof schemas.Apply>;
export type Category = FromSchema<typeof schemas.Category>;
Expand Down
Original file line number Diff line number Diff line change
@@ -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<typeof schemas.GetAnything.metadata>;
export type GetAnythingResponse2XX = FromSchema<typeof schemas.GetAnything.response['2XX']>;
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/simple/src/types.ts
Original file line number Diff line number Diff line change
@@ -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<typeof schemas.Category>;
export type FindPetsByStatusMetadataParam = FromSchema<typeof schemas.FindPetsByStatus.metadata>;
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/star-trek/src/types.ts
Original file line number Diff line number Diff line change
@@ -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<typeof schemas.AnimalBase>;
export type AnimalBaseResponse = FromSchema<typeof schemas.AnimalBaseResponse>;
Expand Down

0 comments on commit 2aa1a45

Please sign in to comment.