MichalLytek / MichalLytek/type-graphql

Fields decorator to inject parsed AST info

Open
#10 8 comments 19 reactions 0 assignees View on GitHub
Enhancement :new: Good First Issue :wave: Help Wanted :sos:
Dominant language
TypeScript
Stars
8.1k
Forks
672
PR merge metrics
No merged PRs in 30d

Description

Some people instead of batching and caching separate resolvers (#51) prefer to load all the data manually. So when they resolve the query, they parse the resolve info object to get a list/structure of fields to fetch from DB or API and then create specific query to DB/API.

Also it might be useful for selecting fields/columns from DB, e.g. when the GraphQL query requires only a single field but our database SQL query has to be universal so it has `*` so it returns a lot of unnecessary data, like other 30 columns/fields.

It would be nice to have a decorator for that with nice integration with [`graphql-fields`](https://github.com/robrichard/graphql-fields). It should convert the returned object to a mongo-like convention (https://github.com/robrichard/graphql-fields/issues/5) and have an ability to return array of keys in first level (without nesting) for sql queries optimization.

It should also take care about mapping the GraphQL field names (provided with `{ name: "fieldName" }` option) to the TS property names.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the requested integration with graphql-fields and its linked nested-field convention. The issue does not identify repository files, tests, or an entry point, and leaves the decorator API, name mapping, and first-level key behavior to be designed. Done would require an agreed implementation and tests covering these requirements.

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
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.