-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55aff80
commit 19e841b
Showing
20 changed files
with
452 additions
and
781 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: Emit `isAbstract` decorator option | ||
sidebar_label: Emit isAbstract | ||
--- | ||
|
||
By default, TypeGraphQL Prisma generator aims to work with newest release of TypeGraphQL. | ||
However, for backward compatibility reasons, there are some config options introduced. | ||
|
||
One of such options is `emitIsAbstract` generator option: | ||
|
||
```prisma {3} | ||
generator typegraphql { | ||
provider = "typegraphql-prisma" | ||
emitIsAbstract = true | ||
} | ||
``` | ||
|
||
When this option is set to true, it generates `isAbstract: true` decorator option for `@ObjectType` (models, outputs) and `@InputType` classes: | ||
|
||
```ts {2} | ||
@TypeGraphQL.ObjectType("Post", { | ||
isAbstract: true, | ||
}) | ||
export class Post { | ||
@TypeGraphQL.Field(_type => TypeGraphQL.ID, { | ||
nullable: false, | ||
}) | ||
uuid!: string; | ||
|
||
// ... | ||
} | ||
``` | ||
|
||
This decorator option prevents from emitting those types in GraphQL schema if they are not referenced directly in the other types consumed by resolvers. | ||
It only matters if you use the resolvers auto discovery feature (e.g. `resolvers: ["./src/**/*.resolver.ts"]`), that was supported in TypeGraphQL up to the `v2.0.0-beta.1` and removed in newer releases. | ||
|
||
Hence this option is set to `false` by default, so if you still using some old version of TypeGraphQL together with resolvers auto discovery feature, you need to enable `emitIsAbstract = true` in your Prisma schema. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.