MichalLytek / MichalLytek/typegraphql-prisma
Overwriting types classes
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 918
- Forks
- 130
- PR merge metrics
- No merged PRs in 30d
Description
Right now we can easily add our own resolvers, own object types, args, inputs, etc.
However, we can't easily change and replace implementation of one object type or input type, like simplifying `StringFilter` or some `UserWhereUnique` input.
It would be possible to allow providing alternative implementation of such types, e.g. with proper validation:
```ts
@InputType()
class UserWhereUnique {
// alternative body, fields and decorators used
}
const typeReplacementMap = {
inputs: {
UserWhereUnique
},
};
export default typeReplacementMap;
```
So the generated artifacts would always use that provided type instead of the default generated ones:
```ts
@ArgsType()
export class UserFindOneArgs {
@Field(() => typeReplacementMap.inputs.UserWhereUnique)
name!: UserWhereUnique;
}
```
This will make the generated artifacts harder to eject and use as standalone code but will reduce the need to do the eject at all.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start at the generator's emitted ArgsType and InputType artifacts, then trace how UserWhereUnique is selected; done means a validated replacement map can substitute generated object and input types without requiring an eject.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100