Skip to content

Commit

Permalink
Enforce keeping naming convention for preset (#186)
Browse files Browse the repository at this point in the history
* Always keep naming convention to avoid duplicating logic from typescript plugin

* Add changeset

* Rebase e2e tests

* Update changeset
  • Loading branch information
eddeee888 authored Sep 6, 2023
1 parent ccdc5e2 commit d5d9577
Show file tree
Hide file tree
Showing 21 changed files with 208 additions and 174 deletions.
9 changes: 9 additions & 0 deletions .changeset/olive-parrots-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@eddeee888/gcg-typescript-resolver-files': minor
---

Drop support for `typesPluginsConfig.namingConvention` - this is now always `keep`

In the preset, we made the assumption that the types used in resolver files are in the same format as the schema. So we `keep` the naming convention.

Some types in `types.generated.ts` are affected. However, they are not currently used in any of the resolver files. So, if consumers have leaned into the recommended default config and generated resolver files (which is the intention of the preset), then there should be no issue upgrading.
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ export type Scalars = {
};

export enum Currency {
Aud = 'AUD',
Usd = 'USD',
AUD = 'AUD',
USD = 'USD',
}

export type Error = {
error: ErrorType;
};

export enum ErrorType {
ForbiddenError = 'FORBIDDEN_ERROR',
InputValidationError = 'INPUT_VALIDATION_ERROR',
NotFound = 'NOT_FOUND',
UnexpectedError = 'UNEXPECTED_ERROR',
FORBIDDEN_ERROR = 'FORBIDDEN_ERROR',
INPUT_VALIDATION_ERROR = 'INPUT_VALIDATION_ERROR',
NOT_FOUND = 'NOT_FOUND',
UNEXPECTED_ERROR = 'UNEXPECTED_ERROR',
}

export type Mutation = {
Expand All @@ -62,11 +62,11 @@ export type Mutation = {
topicEdit: TopicEditPayload;
};

export type MutationTopicCreateArgs = {
export type MutationtopicCreateArgs = {
input: TopicCreateInput;
};

export type MutationTopicEditArgs = {
export type MutationtopicEditArgs = {
input: TopicEditInput;
};

Expand Down Expand Up @@ -96,15 +96,15 @@ export type Query = {
userByAccountName: UserPayload;
};

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

export type QueryTopicsCreatedByUserArgs = {
export type QuerytopicsCreatedByUserArgs = {
input: TopicsCreatedByUserInput;
};

export type QueryUserByAccountNameArgs = {
export type QueryuserByAccountNameArgs = {
accountName: Scalars['String']['input'];
};

Expand Down Expand Up @@ -428,13 +428,13 @@ export type MutationResolvers<
ResolversTypes['TopicCreatePayload'],
ParentType,
ContextType,
RequireFields<MutationTopicCreateArgs, 'input'>
RequireFields<MutationtopicCreateArgs, 'input'>
>;
topicEdit?: Resolver<
ResolversTypes['TopicEditPayload'],
ParentType,
ContextType,
RequireFields<MutationTopicEditArgs, 'input'>
RequireFields<MutationtopicEditArgs, 'input'>
>;
};

Expand Down Expand Up @@ -466,19 +466,19 @@ export type QueryResolvers<
ResolversTypes['TopicByIdPayload'],
ParentType,
ContextType,
RequireFields<QueryTopicByIdArgs, 'id'>
RequireFields<QuerytopicByIdArgs, 'id'>
>;
topicsCreatedByUser?: Resolver<
ResolversTypes['TopicsCreatedByUserPayload'],
ParentType,
ContextType,
RequireFields<QueryTopicsCreatedByUserArgs, 'input'>
RequireFields<QuerytopicsCreatedByUserArgs, 'input'>
>;
userByAccountName?: Resolver<
ResolversTypes['UserPayload'],
ParentType,
ContextType,
RequireFields<QueryUserByAccountNameArgs, 'accountName'>
RequireFields<QueryuserByAccountNameArgs, 'accountName'>
>;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export type Query = {
cat?: Maybe<Cat>;
};

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

Expand Down Expand Up @@ -195,7 +195,7 @@ export type QueryResolvers<
Maybe<ResolversTypes['Cat']>,
ParentType,
ContextType,
RequireFields<QueryCatArgs, 'id'>
RequireFields<QuerycatArgs, 'id'>
>;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ export type Mutation = {
topicEdit: TopicEditPayload;
};

export type MutationTopicCreateArgs = {
export type MutationtopicCreateArgs = {
input: TopicCreateInput;
};

export type MutationTopicEditArgs = {
export type MutationtopicEditArgs = {
input: TopicEditInput;
};

Expand Down Expand Up @@ -94,15 +94,15 @@ export type Query = {
userByAccountName: UserPayload;
};

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

export type QueryTopicsCreatedByUserArgs = {
export type QuerytopicsCreatedByUserArgs = {
input: TopicsCreatedByUserInput;
};

export type QueryUserByAccountNameArgs = {
export type QueryuserByAccountNameArgs = {
accountName: Scalars['String']['input'];
};

Expand Down Expand Up @@ -439,13 +439,13 @@ export type MutationResolvers<
ResolversTypes['TopicCreatePayload'],
ParentType,
ContextType,
RequireFields<MutationTopicCreateArgs, 'input'>
RequireFields<MutationtopicCreateArgs, 'input'>
>;
topicEdit?: Resolver<
ResolversTypes['TopicEditPayload'],
ParentType,
ContextType,
RequireFields<MutationTopicEditArgs, 'input'>
RequireFields<MutationtopicEditArgs, 'input'>
>;
};

Expand Down Expand Up @@ -485,19 +485,19 @@ export type QueryResolvers<
ResolversTypes['TopicByIdPayload'],
ParentType,
ContextType,
RequireFields<QueryTopicByIdArgs, 'id'>
RequireFields<QuerytopicByIdArgs, 'id'>
>;
topicsCreatedByUser?: Resolver<
ResolversTypes['TopicsCreatedByUserPayload'],
ParentType,
ContextType,
RequireFields<QueryTopicsCreatedByUserArgs, 'input'>
RequireFields<QuerytopicsCreatedByUserArgs, 'input'>
>;
userByAccountName?: Resolver<
ResolversTypes['UserPayload'],
ParentType,
ContextType,
RequireFields<QueryUserByAccountNameArgs, 'accountName'>
RequireFields<QueryuserByAccountNameArgs, 'accountName'>
>;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ export type Mutation = {
topicEdit: TopicEditPayload;
};

export type MutationTopicCreateArgs = {
export type MutationtopicCreateArgs = {
input: TopicCreateInput;
};

export type MutationTopicEditArgs = {
export type MutationtopicEditArgs = {
input: TopicEditInput;
};

Expand Down Expand Up @@ -94,15 +94,15 @@ export type Query = {
userByAccountName: UserPayload;
};

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

export type QueryTopicsCreatedByUserArgs = {
export type QuerytopicsCreatedByUserArgs = {
input: TopicsCreatedByUserInput;
};

export type QueryUserByAccountNameArgs = {
export type QueryuserByAccountNameArgs = {
accountName: Scalars['String']['input'];
};

Expand Down Expand Up @@ -473,13 +473,13 @@ export type MutationResolvers<
ResolversTypes['TopicCreatePayload'],
ParentType,
ContextType,
RequireFields<MutationTopicCreateArgs, 'input'>
RequireFields<MutationtopicCreateArgs, 'input'>
>;
topicEdit?: Resolver<
ResolversTypes['TopicEditPayload'],
ParentType,
ContextType,
RequireFields<MutationTopicEditArgs, 'input'>
RequireFields<MutationtopicEditArgs, 'input'>
>;
};

Expand Down Expand Up @@ -511,19 +511,19 @@ export type QueryResolvers<
ResolversTypes['TopicByIdPayload'],
ParentType,
ContextType,
RequireFields<QueryTopicByIdArgs, 'id'>
RequireFields<QuerytopicByIdArgs, 'id'>
>;
topicsCreatedByUser?: Resolver<
ResolversTypes['TopicsCreatedByUserPayload'],
ParentType,
ContextType,
RequireFields<QueryTopicsCreatedByUserArgs, 'input'>
RequireFields<QuerytopicsCreatedByUserArgs, 'input'>
>;
userByAccountName?: Resolver<
ResolversTypes['UserPayload'],
ParentType,
ContextType,
RequireFields<QueryUserByAccountNameArgs, 'accountName'>
RequireFields<QueryuserByAccountNameArgs, 'accountName'>
>;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ export type Mutation = {
topicEdit: TopicEditPayload;
};

export type MutationTopicCreateArgs = {
export type MutationtopicCreateArgs = {
input: TopicCreateInput;
};

export type MutationTopicEditArgs = {
export type MutationtopicEditArgs = {
input: TopicEditInput;
};

Expand All @@ -97,15 +97,15 @@ export type Query = {
userByAccountName: UserPayload;
};

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

export type QueryTopicsCreatedByUserArgs = {
export type QuerytopicsCreatedByUserArgs = {
input: TopicsCreatedByUserInput;
};

export type QueryUserByAccountNameArgs = {
export type QueryuserByAccountNameArgs = {
accountName: Scalars['String']['input'];
};

Expand Down Expand Up @@ -457,13 +457,13 @@ export type MutationResolvers<
ResolversTypes['TopicCreatePayload'],
ParentType,
ContextType,
RequireFields<MutationTopicCreateArgs, 'input'>
RequireFields<MutationtopicCreateArgs, 'input'>
>;
topicEdit?: Resolver<
ResolversTypes['TopicEditPayload'],
ParentType,
ContextType,
RequireFields<MutationTopicEditArgs, 'input'>
RequireFields<MutationtopicEditArgs, 'input'>
>;
};

Expand Down Expand Up @@ -496,19 +496,19 @@ export type QueryResolvers<
ResolversTypes['TopicByIdPayload'],
ParentType,
ContextType,
RequireFields<QueryTopicByIdArgs, 'id'>
RequireFields<QuerytopicByIdArgs, 'id'>
>;
topicsCreatedByUser?: Resolver<
ResolversTypes['TopicsCreatedByUserPayload'],
ParentType,
ContextType,
RequireFields<QueryTopicsCreatedByUserArgs, 'input'>
RequireFields<QuerytopicsCreatedByUserArgs, 'input'>
>;
userByAccountName?: Resolver<
ResolversTypes['UserPayload'],
ParentType,
ContextType,
RequireFields<QueryUserByAccountNameArgs, 'accountName'>
RequireFields<QueryuserByAccountNameArgs, 'accountName'>
>;
};

Expand Down
Loading

0 comments on commit d5d9577

Please sign in to comment.