question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resolvers input subfields with defaults resolve into nullable

See original GitHub issue

Describe the bug

Resolvers input subfields with defaults resolve into nullable

Your Example Website or App

https://stackblitz.com/edit/node-ve8vhp?file=schema.graphql

Steps to Reproduce the Bug or Issue

typescript-resolvers:
overwrite: true
schema:
  - schema.graphql

documents: null
generates:
  generated-types.ts:
    plugins:
      - 'typescript'
      - 'typescript-resolvers'

and this is the schema:

type User {
  name: String
}

input GetUserArgs {
   offset: Int = 0
}

type Query {
  getUsers(getUsersArgs: GetUserArgs): [User]
}

Expected behavior

for offset arg to be wrapped with RequireFields in the. resolver type

Screenshots or Videos

No response

Platform

Codegen Config File

No response

Additional context

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
xiaoliu-hengcommented, Jul 21, 2022

The reason why the offset is nullable.
Kind is import from graphql

image

0reactions
ZiiMakccommented, Jul 22, 2022

If user pass null as argument explicitly, it can be null, so it works as it should be. See #8129

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolvers - Apollo GraphQL Docs
A resolver is a function that's responsible for populating the data for a single field in your schema. It can populate that data...
Read more >
Resolvers – GraphQL Tools
Default Resolver · Returns a property from obj with the relevant field name, or · Calls a function on obj with the relevant...
Read more >
GraphQL Resolvers: Best Practices | by Mark Stuart - Medium
A resolver is a function that resolves a value for a type or field in a schema. Resolvers can return objects or scalars...
Read more >
Why does a GraphQL query return null? - Stack Overflow
There's two common reasons your field or fields are resolving to null: 1) returning data in the wrong shape inside your resolver; ...
Read more >
Types and Fields - TypeGraphQL
By default, all fields are non nullable, just like properties in TypeScript. However, you can change that behavior by providing nullableByDefault: true ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found