Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): import schemas in the types file as types #815

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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