We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Given a schema that uses input objects for queries/mutations:
input SampleEntityInput { entityId: String! } type Query { sampleEntity(input: SampleEntityInput!): SampleEntityResponse! }
The following types are generated:
export interface SampleEntityInput { entityId: string; } export interface IQuery { sampleEntity(input: SampleEntityInput): SampleEntityResponse | Promise<SampleEntityResponse>; }
But the actual input that comes in through the resolver is wrapped in input, e.g.
input
{"input":{"entityId":"fe3ccdf4-6d48-43a6-915a-78843fd64674"}}
Which forces you to define the actual input type yourself in the resolver:
@Query() async sampleEntity(@Args() { input }: { input: SampleEntityInput }) { ... }
Similar to graphql-codegen, additional types should be generated that are wrapped in the input name so they can be used in the resolvers.
graphql-codegen
e.g.
export interface QuerySampleEntityInput { input: SampleEntityInput; }
And used in the resolver:
@Query() async sampleEntity(@Args() { input }: QuerySampleEntityInput) { ... }
No response
The text was updated successfully, but these errors were encountered:
Would you like to create a PR for this?
Sorry, something went wrong.
@kal4l you can also pass the name argument to the @ Args() decorator.
@Query() async sampleEntity(@Args('input') input: QuerySampleEntityInput) { ... }
This then the input object is not wrapped in a object.
No branches or pull requests
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
Given a schema that uses input objects for queries/mutations:
The following types are generated:
But the actual input that comes in through the resolver is wrapped in
input
, e.g.Which forces you to define the actual input type yourself in the resolver:
Describe the solution you'd like
Similar to
graphql-codegen
, additional types should be generated that are wrapped in the input name so they can be used in the resolvers.e.g.
And used in the resolver:
Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
The text was updated successfully, but these errors were encountered: