Skip to content

Commit

Permalink
feat: reduce code output of client preset (#10073)
Browse files Browse the repository at this point in the history
* feat: reduce code output

* update fixtures

* use existing options
  • Loading branch information
n1ru4l authored Jul 30, 2024
1 parent 73c5cfc commit 8471a18
Show file tree
Hide file tree
Showing 25 changed files with 12 additions and 18,220 deletions.
5 changes: 5 additions & 0 deletions .changeset/cold-pants-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-codegen/client-preset': minor
---

Reduce noise of generated code by only generating code relevant to GraphQL operations.
89 changes: 0 additions & 89 deletions dev-test/gql-tag-operations-masking/gql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,95 +18,6 @@ export type Scalars = {
Url: { input: any; output: any };
};

export type Meta = {
__typename?: 'Meta';
count?: Maybe<Scalars['Int']['output']>;
};

export type Mutation = {
__typename?: 'Mutation';
createTweet?: Maybe<Tweet>;
deleteTweet?: Maybe<Tweet>;
markTweetRead?: Maybe<Scalars['Boolean']['output']>;
};

export type MutationCreateTweetArgs = {
body?: InputMaybe<Scalars['String']['input']>;
};

export type MutationDeleteTweetArgs = {
id: Scalars['ID']['input'];
};

export type MutationMarkTweetReadArgs = {
id: Scalars['ID']['input'];
};

export type Notification = {
__typename?: 'Notification';
date?: Maybe<Scalars['Date']['output']>;
id?: Maybe<Scalars['ID']['output']>;
type?: Maybe<Scalars['String']['output']>;
};

export type Query = {
__typename?: 'Query';
Notifications?: Maybe<Array<Maybe<Notification>>>;
NotificationsMeta?: Maybe<Meta>;
Tweet?: Maybe<Tweet>;
Tweets?: Maybe<Array<Tweet>>;
TweetsMeta?: Maybe<Meta>;
User?: Maybe<User>;
};

export type QueryNotificationsArgs = {
limit?: InputMaybe<Scalars['Int']['input']>;
};

export type QueryTweetArgs = {
id: Scalars['ID']['input'];
};

export type QueryTweetsArgs = {
limit?: InputMaybe<Scalars['Int']['input']>;
skip?: InputMaybe<Scalars['Int']['input']>;
sort_field?: InputMaybe<Scalars['String']['input']>;
sort_order?: InputMaybe<Scalars['String']['input']>;
};

export type QueryUserArgs = {
id: Scalars['ID']['input'];
};

export type Stat = {
__typename?: 'Stat';
likes?: Maybe<Scalars['Int']['output']>;
responses?: Maybe<Scalars['Int']['output']>;
retweets?: Maybe<Scalars['Int']['output']>;
views?: Maybe<Scalars['Int']['output']>;
};

export type Tweet = {
__typename?: 'Tweet';
Stats?: Maybe<Stat>;
author: User;
body: Scalars['String']['output'];
date?: Maybe<Scalars['Date']['output']>;
id: Scalars['ID']['output'];
};

export type User = {
__typename?: 'User';
avatar_url?: Maybe<Scalars['Url']['output']>;
first_name?: Maybe<Scalars['String']['output']>;
full_name?: Maybe<Scalars['String']['output']>;
id: Scalars['ID']['output'];
last_name?: Maybe<Scalars['String']['output']>;
/** @deprecated Field no longer supported */
name?: Maybe<Scalars['String']['output']>;
username?: Maybe<Scalars['String']['output']>;
};

export type TweetFragmentFragment = ({ __typename?: 'Tweet'; id: string; body: string } & {
' $fragmentRefs'?: { TweetAuthorFragmentFragment: TweetAuthorFragmentFragment };
}) & { ' $fragmentName'?: 'TweetFragmentFragment' };
Expand Down
89 changes: 0 additions & 89 deletions dev-test/gql-tag-operations-urql/gql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,95 +18,6 @@ export type Scalars = {
Url: { input: any; output: any };
};

export type Meta = {
__typename?: 'Meta';
count?: Maybe<Scalars['Int']['output']>;
};

export type Mutation = {
__typename?: 'Mutation';
createTweet?: Maybe<Tweet>;
deleteTweet?: Maybe<Tweet>;
markTweetRead?: Maybe<Scalars['Boolean']['output']>;
};

export type MutationCreateTweetArgs = {
body?: InputMaybe<Scalars['String']['input']>;
};

export type MutationDeleteTweetArgs = {
id: Scalars['ID']['input'];
};

export type MutationMarkTweetReadArgs = {
id: Scalars['ID']['input'];
};

export type Notification = {
__typename?: 'Notification';
date?: Maybe<Scalars['Date']['output']>;
id?: Maybe<Scalars['ID']['output']>;
type?: Maybe<Scalars['String']['output']>;
};

export type Query = {
__typename?: 'Query';
Notifications?: Maybe<Array<Maybe<Notification>>>;
NotificationsMeta?: Maybe<Meta>;
Tweet?: Maybe<Tweet>;
Tweets?: Maybe<Array<Maybe<Tweet>>>;
TweetsMeta?: Maybe<Meta>;
User?: Maybe<User>;
};

export type QueryNotificationsArgs = {
limit?: InputMaybe<Scalars['Int']['input']>;
};

export type QueryTweetArgs = {
id: Scalars['ID']['input'];
};

export type QueryTweetsArgs = {
limit?: InputMaybe<Scalars['Int']['input']>;
skip?: InputMaybe<Scalars['Int']['input']>;
sort_field?: InputMaybe<Scalars['String']['input']>;
sort_order?: InputMaybe<Scalars['String']['input']>;
};

export type QueryUserArgs = {
id: Scalars['ID']['input'];
};

export type Stat = {
__typename?: 'Stat';
likes?: Maybe<Scalars['Int']['output']>;
responses?: Maybe<Scalars['Int']['output']>;
retweets?: Maybe<Scalars['Int']['output']>;
views?: Maybe<Scalars['Int']['output']>;
};

export type Tweet = {
__typename?: 'Tweet';
Author?: Maybe<User>;
Stats?: Maybe<Stat>;
body?: Maybe<Scalars['String']['output']>;
date?: Maybe<Scalars['Date']['output']>;
id: Scalars['ID']['output'];
};

export type User = {
__typename?: 'User';
avatar_url?: Maybe<Scalars['Url']['output']>;
first_name?: Maybe<Scalars['String']['output']>;
full_name?: Maybe<Scalars['String']['output']>;
id: Scalars['ID']['output'];
last_name?: Maybe<Scalars['String']['output']>;
/** @deprecated Field no longer supported */
name?: Maybe<Scalars['String']['output']>;
username?: Maybe<Scalars['String']['output']>;
};

export type FooQueryVariables = Exact<{ [key: string]: never }>;

export type FooQuery = { __typename?: 'Query'; Tweets?: Array<{ __typename?: 'Tweet'; id: string } | null> | null };
Expand Down
89 changes: 0 additions & 89 deletions dev-test/gql-tag-operations/gql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,95 +18,6 @@ export type Scalars = {
Url: { input: any; output: any };
};

export type Meta = {
__typename?: 'Meta';
count?: Maybe<Scalars['Int']['output']>;
};

export type Mutation = {
__typename?: 'Mutation';
createTweet?: Maybe<Tweet>;
deleteTweet?: Maybe<Tweet>;
markTweetRead?: Maybe<Scalars['Boolean']['output']>;
};

export type MutationCreateTweetArgs = {
body?: InputMaybe<Scalars['String']['input']>;
};

export type MutationDeleteTweetArgs = {
id: Scalars['ID']['input'];
};

export type MutationMarkTweetReadArgs = {
id: Scalars['ID']['input'];
};

export type Notification = {
__typename?: 'Notification';
date?: Maybe<Scalars['Date']['output']>;
id?: Maybe<Scalars['ID']['output']>;
type?: Maybe<Scalars['String']['output']>;
};

export type Query = {
__typename?: 'Query';
Notifications?: Maybe<Array<Maybe<Notification>>>;
NotificationsMeta?: Maybe<Meta>;
Tweet?: Maybe<Tweet>;
Tweets?: Maybe<Array<Maybe<Tweet>>>;
TweetsMeta?: Maybe<Meta>;
User?: Maybe<User>;
};

export type QueryNotificationsArgs = {
limit?: InputMaybe<Scalars['Int']['input']>;
};

export type QueryTweetArgs = {
id: Scalars['ID']['input'];
};

export type QueryTweetsArgs = {
limit?: InputMaybe<Scalars['Int']['input']>;
skip?: InputMaybe<Scalars['Int']['input']>;
sort_field?: InputMaybe<Scalars['String']['input']>;
sort_order?: InputMaybe<Scalars['String']['input']>;
};

export type QueryUserArgs = {
id: Scalars['ID']['input'];
};

export type Stat = {
__typename?: 'Stat';
likes?: Maybe<Scalars['Int']['output']>;
responses?: Maybe<Scalars['Int']['output']>;
retweets?: Maybe<Scalars['Int']['output']>;
views?: Maybe<Scalars['Int']['output']>;
};

export type Tweet = {
__typename?: 'Tweet';
Author?: Maybe<User>;
Stats?: Maybe<Stat>;
body?: Maybe<Scalars['String']['output']>;
date?: Maybe<Scalars['Date']['output']>;
id: Scalars['ID']['output'];
};

export type User = {
__typename?: 'User';
avatar_url?: Maybe<Scalars['Url']['output']>;
first_name?: Maybe<Scalars['String']['output']>;
full_name?: Maybe<Scalars['String']['output']>;
id: Scalars['ID']['output'];
last_name?: Maybe<Scalars['String']['output']>;
/** @deprecated Field no longer supported */
name?: Maybe<Scalars['String']['output']>;
username?: Maybe<Scalars['String']['output']>;
};

export type FooQueryVariables = Exact<{ [key: string]: never }>;

export type FooQuery = { __typename?: 'Query'; Tweets?: Array<{ __typename?: 'Tweet'; id: string } | null> | null };
Expand Down
89 changes: 0 additions & 89 deletions dev-test/gql-tag-operations/graphql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,95 +18,6 @@ export type Scalars = {
Url: { input: any; output: any };
};

export type Meta = {
__typename?: 'Meta';
count?: Maybe<Scalars['Int']['output']>;
};

export type Mutation = {
__typename?: 'Mutation';
createTweet?: Maybe<Tweet>;
deleteTweet?: Maybe<Tweet>;
markTweetRead?: Maybe<Scalars['Boolean']['output']>;
};

export type MutationCreateTweetArgs = {
body?: InputMaybe<Scalars['String']['input']>;
};

export type MutationDeleteTweetArgs = {
id: Scalars['ID']['input'];
};

export type MutationMarkTweetReadArgs = {
id: Scalars['ID']['input'];
};

export type Notification = {
__typename?: 'Notification';
date?: Maybe<Scalars['Date']['output']>;
id?: Maybe<Scalars['ID']['output']>;
type?: Maybe<Scalars['String']['output']>;
};

export type Query = {
__typename?: 'Query';
Notifications?: Maybe<Array<Maybe<Notification>>>;
NotificationsMeta?: Maybe<Meta>;
Tweet?: Maybe<Tweet>;
Tweets?: Maybe<Array<Maybe<Tweet>>>;
TweetsMeta?: Maybe<Meta>;
User?: Maybe<User>;
};

export type QueryNotificationsArgs = {
limit?: InputMaybe<Scalars['Int']['input']>;
};

export type QueryTweetArgs = {
id: Scalars['ID']['input'];
};

export type QueryTweetsArgs = {
limit?: InputMaybe<Scalars['Int']['input']>;
skip?: InputMaybe<Scalars['Int']['input']>;
sort_field?: InputMaybe<Scalars['String']['input']>;
sort_order?: InputMaybe<Scalars['String']['input']>;
};

export type QueryUserArgs = {
id: Scalars['ID']['input'];
};

export type Stat = {
__typename?: 'Stat';
likes?: Maybe<Scalars['Int']['output']>;
responses?: Maybe<Scalars['Int']['output']>;
retweets?: Maybe<Scalars['Int']['output']>;
views?: Maybe<Scalars['Int']['output']>;
};

export type Tweet = {
__typename?: 'Tweet';
Author?: Maybe<User>;
Stats?: Maybe<Stat>;
body?: Maybe<Scalars['String']['output']>;
date?: Maybe<Scalars['Date']['output']>;
id: Scalars['ID']['output'];
};

export type User = {
__typename?: 'User';
avatar_url?: Maybe<Scalars['Url']['output']>;
first_name?: Maybe<Scalars['String']['output']>;
full_name?: Maybe<Scalars['String']['output']>;
id: Scalars['ID']['output'];
last_name?: Maybe<Scalars['String']['output']>;
/** @deprecated Field no longer supported */
name?: Maybe<Scalars['String']['output']>;
username?: Maybe<Scalars['String']['output']>;
};

export type FooQueryVariables = Exact<{ [key: string]: never }>;

export type FooQuery = { __typename?: 'Query'; Tweets?: Array<{ __typename?: 'Tweet'; id: string } | null> | null };
Expand Down
Loading

0 comments on commit 8471a18

Please sign in to comment.