Skip to content
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
6 changes: 6 additions & 0 deletions .changeset/clever-loops-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@graphql-codegen/visitor-plugin-common': minor
'@graphql-codegen/typescript-operations': minor
---

Add importSchemaTypesFrom support
19 changes: 19 additions & 0 deletions dev-test/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,25 @@ const config: CodegenConfig = {
},
},
},

// standalone-operations
'./dev-test/standalone-operations/import-schema-types/_base.generated.ts': {
schema: './dev-test/standalone-operations/schema.graphql',
documents: ['./dev-test/standalone-operations/import-schema-types/*.graphql'],
plugins: ['typescript-operations'],
config: {
generatesOperationTypes: false,
},
},
'./dev-test/standalone-operations/import-schema-types/_types.generated.ts': {
schema: './dev-test/standalone-operations/schema.graphql',
documents: ['./dev-test/standalone-operations/import-schema-types/*.graphql'],
plugins: ['typescript-operations'],
config: {
importSchemaTypesFrom: './dev-test/standalone-operations/import-schema-types/_base.generated.ts',
namespacedImportName: 'Types',
},
},
},
};

Expand Down
12 changes: 0 additions & 12 deletions dev-test/githunt/typed-document-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,6 @@ export enum VoteType {
Up = 'UP',
}

/** A list of options for the sort order of the feed */
export type FeedType =
/** Sort by a combination of freshness and score, using Reddit's algorithm */
| 'HOT'
/** Newest entries first */
| 'NEW'
/** Highest score entries first */
| 'TOP';

/** The type of vote to record, when submitting a vote */
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';

export type OnCommentAddedSubscriptionVariables = Exact<{
repoFullName: string;
}>;
Expand Down
12 changes: 0 additions & 12 deletions dev-test/githunt/types.avoidOptionals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,6 @@ export enum VoteType {
Up = 'UP',
}

/** A list of options for the sort order of the feed */
export type FeedType =
/** Sort by a combination of freshness and score, using Reddit's algorithm */
| 'HOT'
/** Newest entries first */
| 'NEW'
/** Highest score entries first */
| 'TOP';

/** The type of vote to record, when submitting a vote */
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';

export type OnCommentAddedSubscriptionVariables = Exact<{
repoFullName: string;
}>;
Expand Down
12 changes: 0 additions & 12 deletions dev-test/githunt/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,6 @@ export type Vote = {
/** The type of vote to record, when submitting a vote */
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';

/** A list of options for the sort order of the feed */
export type FeedType =
/** Sort by a combination of freshness and score, using Reddit's algorithm */
| 'HOT'
/** Newest entries first */
| 'NEW'
/** Highest score entries first */
| 'TOP';

/** The type of vote to record, when submitting a vote */
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';

export type OnCommentAddedSubscriptionVariables = Exact<{
repoFullName: string;
}>;
Expand Down
12 changes: 0 additions & 12 deletions dev-test/githunt/types.enumsAsTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,6 @@ export type Vote = {
/** The type of vote to record, when submitting a vote */
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';

/** A list of options for the sort order of the feed */
export type FeedType =
/** Sort by a combination of freshness and score, using Reddit's algorithm */
| 'HOT'
/** Newest entries first */
| 'NEW'
/** Highest score entries first */
| 'TOP';

/** The type of vote to record, when submitting a vote */
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';

export type OnCommentAddedSubscriptionVariables = Exact<{
repoFullName: string;
}>;
Expand Down
12 changes: 0 additions & 12 deletions dev-test/githunt/types.flatten.preResolveTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,6 @@ export enum VoteType {
Up = 'UP',
}

/** A list of options for the sort order of the feed */
export type FeedType =
/** Sort by a combination of freshness and score, using Reddit's algorithm */
| 'HOT'
/** Newest entries first */
| 'NEW'
/** Highest score entries first */
| 'TOP';

/** The type of vote to record, when submitting a vote */
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';

export type OnCommentAddedSubscriptionVariables = Exact<{
repoFullName: string;
}>;
Expand Down
12 changes: 0 additions & 12 deletions dev-test/githunt/types.immutableTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,6 @@ export enum VoteType {
Up = 'UP',
}

/** A list of options for the sort order of the feed */
export type FeedType =
/** Sort by a combination of freshness and score, using Reddit's algorithm */
| 'HOT'
/** Newest entries first */
| 'NEW'
/** Highest score entries first */
| 'TOP';

/** The type of vote to record, when submitting a vote */
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';

export type OnCommentAddedSubscriptionVariables = Exact<{
repoFullName: string;
}>;
Expand Down
12 changes: 0 additions & 12 deletions dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@ export enum VoteType {
Up = 'UP',
}

/** A list of options for the sort order of the feed */
export type FeedType =
/** Sort by a combination of freshness and score, using Reddit's algorithm */
| 'HOT'
/** Newest entries first */
| 'NEW'
/** Highest score entries first */
| 'TOP';

/** The type of vote to record, when submitting a vote */
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';

export type OnCommentAddedSubscriptionVariables = Exact<{
repoFullName: string;
}>;
Expand Down
12 changes: 0 additions & 12 deletions dev-test/githunt/types.preResolveTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,6 @@ export enum VoteType {
Up = 'UP',
}

/** A list of options for the sort order of the feed */
export type FeedType =
/** Sort by a combination of freshness and score, using Reddit's algorithm */
| 'HOT'
/** Newest entries first */
| 'NEW'
/** Highest score entries first */
| 'TOP';

/** The type of vote to record, when submitting a vote */
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';

export type OnCommentAddedSubscriptionVariables = Exact<{
repoFullName: string;
}>;
Expand Down
12 changes: 0 additions & 12 deletions dev-test/githunt/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,6 @@ export enum VoteType {
Up = 'UP',
}

/** A list of options for the sort order of the feed */
export type FeedType =
/** Sort by a combination of freshness and score, using Reddit's algorithm */
| 'HOT'
/** Newest entries first */
| 'NEW'
/** Highest score entries first */
| 'TOP';

/** The type of vote to record, when submitting a vote */
export type VoteType = 'CANCEL' | 'DOWN' | 'UP';

export type OnCommentAddedSubscriptionVariables = Exact<{
repoFullName: string;
}>;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** UserRole Description */
export type UserRole =
/** UserRole ADMIN */
| 'ADMIN'
/** UserRole CUSTOMER */
| 'CUSTOMER';
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type * as Types from './_base.generated';

type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
export type WithVariablesQueryVariables = Exact<{
role?: Types.UserRole | null;
}>;

export type WithVariablesQuery = {
__typename?: 'Query';
user?: { __typename?: 'User'; id: string; name: string } | null;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
query WithVariables($role: UserRole) {
user(id: "100") {
id
name
}
}
17 changes: 17 additions & 0 deletions dev-test/standalone-operations/schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
type Query {
user(id: ID!, role: UserRole): User
}

type User {
id: ID!
name: String!
role: UserRole!
}

"UserRole Description"
enum UserRole {
"UserRole ADMIN"
ADMIN
"UserRole CUSTOMER"
CUSTOMER
}
9 changes: 0 additions & 9 deletions dev-test/star-wars/types.avoidOptionals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,6 @@ export type StarshipLengthArgs = {
unit?: InputMaybe<LengthUnit>;
};

/** The episodes in the Star Wars trilogy */
export type Episode =
/** Star Wars Episode V: The Empire Strikes Back, released in 1980. */
| 'EMPIRE'
/** Star Wars Episode VI: Return of the Jedi, released in 1983. */
| 'JEDI'
/** Star Wars Episode IV: A New Hope, released in 1977. */
| 'NEWHOPE';

export type CreateReviewForEpisodeMutationVariables = Exact<{
episode: Episode;
review: ReviewInput;
Expand Down
9 changes: 0 additions & 9 deletions dev-test/star-wars/types.excludeQueryAlpha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,6 @@ export type StarshipLengthArgs = {
unit?: InputMaybe<LengthUnit>;
};

/** The episodes in the Star Wars trilogy */
export type Episode =
/** Star Wars Episode V: The Empire Strikes Back, released in 1980. */
| 'EMPIRE'
/** Star Wars Episode VI: Return of the Jedi, released in 1983. */
| 'JEDI'
/** Star Wars Episode IV: A New Hope, released in 1977. */
| 'NEWHOPE';

export type CreateReviewForEpisodeMutationVariables = Exact<{
episode: Episode;
review: ReviewInput;
Expand Down
9 changes: 0 additions & 9 deletions dev-test/star-wars/types.excludeQueryBeta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,6 @@ export type StarshipLengthArgs = {
unit?: InputMaybe<LengthUnit>;
};

/** The episodes in the Star Wars trilogy */
export type Episode =
/** Star Wars Episode V: The Empire Strikes Back, released in 1980. */
| 'EMPIRE'
/** Star Wars Episode VI: Return of the Jedi, released in 1983. */
| 'JEDI'
/** Star Wars Episode IV: A New Hope, released in 1977. */
| 'NEWHOPE';

export type CreateReviewForEpisodeMutationVariables = Exact<{
episode: Episode;
review: ReviewInput;
Expand Down
9 changes: 0 additions & 9 deletions dev-test/star-wars/types.globallyAvailable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,6 @@ type StarshipLengthArgs = {
unit?: InputMaybe<LengthUnit>;
};

/** The episodes in the Star Wars trilogy */
type Episode =
/** Star Wars Episode V: The Empire Strikes Back, released in 1980. */
| 'EMPIRE'
/** Star Wars Episode VI: Return of the Jedi, released in 1983. */
| 'JEDI'
/** Star Wars Episode IV: A New Hope, released in 1977. */
| 'NEWHOPE';

type CreateReviewForEpisodeMutationVariables = Exact<{
episode: Episode;
review: ReviewInput;
Expand Down
9 changes: 0 additions & 9 deletions dev-test/star-wars/types.immutableTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,6 @@ export type StarshipLengthArgs = {
unit?: InputMaybe<LengthUnit>;
};

/** The episodes in the Star Wars trilogy */
export type Episode =
/** Star Wars Episode V: The Empire Strikes Back, released in 1980. */
| 'EMPIRE'
/** Star Wars Episode VI: Return of the Jedi, released in 1983. */
| 'JEDI'
/** Star Wars Episode IV: A New Hope, released in 1977. */
| 'NEWHOPE';

export type CreateReviewForEpisodeMutationVariables = Exact<{
episode: Episode;
review: ReviewInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,6 @@ export type ReviewInput = {
stars: Scalars['Int']['input'];
};

/** The episodes in the Star Wars trilogy */
export type Episode =
/** Star Wars Episode V: The Empire Strikes Back, released in 1980. */
| 'EMPIRE'
/** Star Wars Episode VI: Return of the Jedi, released in 1983. */
| 'JEDI'
/** Star Wars Episode IV: A New Hope, released in 1977. */
| 'NEWHOPE';

export type CreateReviewForEpisodeMutationVariables = Exact<{
episode: Episode;
review: ReviewInput;
Expand Down
9 changes: 0 additions & 9 deletions dev-test/star-wars/types.preResolveTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,6 @@ export type StarshipLengthArgs = {
unit?: InputMaybe<LengthUnit>;
};

/** The episodes in the Star Wars trilogy */
export type Episode =
/** Star Wars Episode V: The Empire Strikes Back, released in 1980. */
| 'EMPIRE'
/** Star Wars Episode VI: Return of the Jedi, released in 1983. */
| 'JEDI'
/** Star Wars Episode IV: A New Hope, released in 1977. */
| 'NEWHOPE';

export type CreateReviewForEpisodeMutationVariables = Exact<{
episode: Episode;
review: ReviewInput;
Expand Down
9 changes: 0 additions & 9 deletions dev-test/star-wars/types.skipSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,6 @@ export type StarshipLengthArgs = {
unit?: InputMaybe<LengthUnit>;
};

/** The episodes in the Star Wars trilogy */
export type Episode =
/** Star Wars Episode V: The Empire Strikes Back, released in 1980. */
| 'EMPIRE'
/** Star Wars Episode VI: Return of the Jedi, released in 1983. */
| 'JEDI'
/** Star Wars Episode IV: A New Hope, released in 1977. */
| 'NEWHOPE';

Comment on lines -243 to -251
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export type CreateReviewForEpisodeMutationVariables = Exact<{
episode: Episode;
review: ReviewInput;
Expand Down
9 changes: 0 additions & 9 deletions dev-test/star-wars/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,6 @@ export type StarshipLengthArgs = {
unit?: InputMaybe<LengthUnit>;
};

/** The episodes in the Star Wars trilogy */
export type Episode =
/** Star Wars Episode V: The Empire Strikes Back, released in 1980. */
| 'EMPIRE'
/** Star Wars Episode VI: Return of the Jedi, released in 1983. */
| 'JEDI'
/** Star Wars Episode IV: A New Hope, released in 1977. */
| 'NEWHOPE';

export type CreateReviewForEpisodeMutationVariables = Exact<{
episode: Episode;
review: ReviewInput;
Expand Down
Loading