Graphql: Support extra @Args options (code first)

Created on 18 Mar 2019  路  4Comments  路  Source: nestjs/graphql

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior


Cannot create nullable resolver arguments.

Expected behavior


Resolver arguments should support the same/sub-set of options as in type-graphql:

  • nullable
  • defaultValue
  • description

Minimal reproduction of the problem with instructions


Again, sorry for my poor english, here is a small test case to demonstrate the expected behaviour: https://github.com/zhenwenc/nest-graphql-issues/blob/master/test/arguments-options.spec.ts

Environment


Nest version: 6.0.0

Most helpful comment

@Args({
  name: 'id',
  type: () => String,
  nullable: false,
  defaultValue: '1',
})

All 4 comments

It should be fixed in 6.0.1 :) Let me know if you face any issue

How is this supposed to be used? Can you give an example code?

@Args({
  name: 'id',
  type: () => String,
  nullable: false,
  defaultValue: '1',
})

Untitled
You need to change your documentation. It should be:
getAuthor(
@Args( { name: "firstName", nullable: true }) firstName?: string,
@Args( { name: "lastName", defaultValue: '' }) lastName?: string,
) {}

Was this page helpful?
0 / 5 - 0 ratings