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

Resolved arguments contain extra values #409

Closed
HitkoDev opened this issue Aug 30, 2019 · 1 comment
Closed

Resolved arguments contain extra values #409

HitkoDev opened this issue Aug 30, 2019 · 1 comment
Labels
Community 👨‍👧 Something initiated by a community Out of scope ✖️ Proposal doesn't fit in project goals

Comments

@HitkoDev
Copy link

Describe the bug
Params with @Args decorator contain all arguments, not just arguments defined in target type.

return Object.assign(new Target(), data);

To Reproduce

@ArgsType()
class TestArgs {
  @Field(() => String) foo: string
  @Field(() => String) bar: string
}

@Resolver()
class TestResolver {
  @Mutation(() => String)
  test(
    @Arg('extra') extra: string,
    @Args('test') test: TestArgs
  ) {
    console.log(test)
    return extra
  }
}

Expected behavior

{
  "foo": "value",
  "bar": "value"
}

Current behavior

{
  "foo": "value",
  "bar": "value",
  "extra": "value"
}

Enviorment (please complete the following information):
Every environment, all package versions

@MichalLytek
Copy link
Owner

Partially related to #263 but in that case it's working as designed - you shouldn't mix the two ways of registering args.

If you need to add extra argument, just extend TestArgs class.

@MichalLytek MichalLytek added Community 👨‍👧 Something initiated by a community Out of scope ✖️ Proposal doesn't fit in project goals labels Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community 👨‍👧 Something initiated by a community Out of scope ✖️ Proposal doesn't fit in project goals
Projects
None yet
Development

No branches or pull requests

2 participants