MichalLytek / MichalLytek/type-graphql

A way to conditionally hide a field

Open
#1,774 3 comments 0 reactions 0 assignees View on GitHub
Community :family_man_girl: Need More Info :man_shrugging: Question :grey_question:
Dominant language
TypeScript
Stars
8.1k
Forks
672
PR merge metrics
No merged PRs in 30d

Description

**Describe the issue**
I did read the docs but could not find any feature to conditionally hide a field.

I have a simple use case, Each user in my DB has a email, now in some cases I want to return it in Graphql response and in some not, what is the best way to implement it?

Should that be done just in the resolver, or is there a type-graphql Decorator to hide a field conditionally?
Or maybe I should use a FieldResolver and it will override the original return with what I want?

Contributor guide

Open the contributing guide

Research direction

The issue names no files, tests, or entry points. Start by reviewing the project documentation and the TypeScript GraphQL schema and resolver guidance for conditional field exposure. A complete outcome would need a documented supported approach or an accepted implementation scope, neither of which the issue currently specifies.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.