-
-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Feat req: allow extending ObjectType, Resolver, InputType #811
Comments
Please try not to propose an API design, it's my job to develop something easy to use 😉 You should focus on describing as much as possible all the background, the details, the workarounds you do, to allow me better understand your problem and find a good solution for it.
Does it sounds like duplicate of #228? Or the standard GraphQL extending mechanism doesn't work in your case?
Does it sound like a duplicate of #134? 🤔 |
I don't think accessing metadata is a good idea for me as I want to provide the same API of type-graphql when extending these class, creating a mock of each decorator and proxy it to the right place is really annoying.
Yes its something like that, but maybe a little different: my program acts like this:
The problem is that the plugin is community-driven which means I don't know what will be extended and what will be exported when my code's compiling. import { Bus } from 'main';
bus.on('foo', async (args) => {
// do something or make some change to the args
}); Note: if designed as following, the typings should be generated with FooType, BarType will be unable to access for me. // plugin code
import { FooType } from 'main';
class BarType extends FooType { } #228 (comment) could be a solution for me, but it seems currently not supported.
@ObjectType
class A {
methodA(arg1, arg2){ }
}
@ObjectType({ extend: A })
class B {
// automatically pass the original method at the first argument
methodA(_super, arg1, arg2){
const value = _super();
value.key = foo;
return value;
}
} |
TypeGraphQL design goal is to have a statically-analysable classes which you decorate to expose properties and methods via the GraphQL API. It was never intended to have some more complex magic, like generated args/inputs/connection based on model class, etc. So everything like hooking into metadata storage and then making So if you could use the |
Thanks a lot. |
Is your feature request related to a problem? Please describe.
I want to build a API which allows other plugin to dynamically inject some fields/resolvers.
Describe the solution you'd like
and Resolver/Input could be similar to it.
Describe alternatives you've considered
I tried to parse metadata manually but as the type was parsed and stored after calling ObjectType decorator, it's hard to inject other fields(need to hook almost all decorators). Also, I think it would be awesome if type-graphql can support it.
Additional context
void
The text was updated successfully, but these errors were encountered: