Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hoist and reuse field types #88

Open
etareduction opened this issue Jun 2, 2023 · 2 comments
Open

Hoist and reuse field types #88

etareduction opened this issue Jun 2, 2023 · 2 comments

Comments

@etareduction
Copy link
Contributor

Currently complex types in query selection and input types are generated under the query's module, even though they can be the same type in different queries. This makes reuse and creation of functions that operate on types in graphql schema quite difficult. I suggest generating those types under root namespace of a generated project.

@Zaid-Ajaj
Copy link
Owner

Hi @etareduction I found that implementing such feature was really complicated so opted to keep the types separate per query/mutation. For cases where you need to write a function that operates on a generated type, probably easiest is to write a common type by hand and mapper functions from the generated types to the common type, then have the function operate on the common type.

I realize it is not ideal, but it is kind of OK to work with.

@etareduction
Copy link
Contributor Author

Yes, currently i use inline functions with member constraints on argument for a mapper. It is kinda okay for a few types, but i expect having dozens of them. What blockers have you encountered while evaluating the possibility of this feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants