-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[TypeScript Resolvers] feat: Generate Interface types without field resolvers #2194
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
Comments
I reproduced what you have within a test-case: 08ded80 Could you tell me how your |
As @kamilkisiela said, the generated signature doesn't force you to implement the resolvers for the interface's fields. |
Full codegen.yml:
I'm guessing it's due to I can take a look tonight and update the test to match what I want. |
@rynobax yeah the
|
What I want is to have I looked into adding a test for what I want, but I had trouble getting the workspaces to bootstrap. If it would be useful I can keep working on it. I would also be happy to work on a PR for this feature if you want, just let me know. |
@rynobax Make sure you have the latest Yarn installed, clone this repo and run: The exact use-case you mentioned is a bit different, so I'm closing this one, and feel free to open a new issue that described exactly what you need and what options should |
@dotansimha this is an example of what was originally asked for. The interaction between using @rynobax
|
Or put another way, I'd like a way to make the following SDL:
generate the following typings:
Without turning off |
@mscharley I see, this use-case seems fine. If you already managed to change that, maybe you can create a PR for this with a configuration flag? :) |
I haven't made any changes to the code generation, I just made a mapped type inside my application which manages to patch in the desired behaviour. If you're happy that this is an actual issue, can you reopen this please? |
Keeping open, thanks @mscharley . Can you please provide an example for the type you created? maybe it's something we can use in the generated output. |
I'm not sure what you're asking for here, I provided an example SDL for an |
I see. I wanted to add it to the codegen core as configuration, in order to help you to avoid the need to wrap the type. That's why I opened it. If you are fine with the current status, I can close it. |
I would love for this to be a configuration option for this, I'm just confused by what you meant by "Can you please provide an example for the type you created?". I'm pretty sure I already provided examples, so I'm not clear on what you're asking for. |
Thanks @mscharley , I wrote it because I missed your comment with the example :) |
Is your feature request related to a problem? Please describe.
When attempting to generate types for an existing graphql server, I am having trouble getting the generated types for interfaces to match my implementation.
On my server I only specify a
__resolveType
resolver for my interface type, and let the implementing types provide the revolvers for the shared fields. However, when I generate types, the interface type requires that a resolver for all fields be provided.Example
Describe the solution you'd like
I would like to specify in my configuration that I would like interface resolver types to only require a
__resolveType
field.I would be happy to work on adding the functionality if I could get some confirmation this is a feature worth adding, and not just me doing something wrong 😄 .
The text was updated successfully, but these errors were encountered: