MichalLytek / MichalLytek/type-graphql
Schema directives support
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.1k
- Forks
- 672
- PR merge metrics
- No merged PRs in 30d
Description
## Partially solved by https://github.com/MichalLytek/type-graphql/pull/369
### Currently blocked by https://github.com/graphql/graphql-js/issues/1343
---
Ability to define any arbitrary graphql directive to be passed to the compiled schema:
```ts
@ObjectType({ directives: ['@cacheControl(maxAge: 240)'] })
class SampleObject {
// ...
}
```
Which should be equivalent to:
```graphql
type SampleObject @cacheControl(maxAge: 240) {
# ...
}
```
It might be also implemented as a separate decorator that would make possible to create custom decorators like `@CacheControl({ maxAge: 240 })`:
```ts
@Directive('@cacheControl(maxAge: 240)')
@ObjectType()
class SampleObject {
// ...
}
```
Contributor guide
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
Begin with PR #369 and graphql/graphql-js issue #1343; they identify the existing partial work and external blocker. Once unblocked, completion means supporting arbitrary directives on the compiled schema, including the illustrated ObjectType option or Directive decorator behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100