Resolvers input subfields with defaults resolve into nullable
See original GitHub issueDescribe 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
- OS: macOS
- NodeJS: 16.14.2
graphql
version: 16.0.1- “@graphql-codegen/cli”: “2.9.0”
- “@graphql-codegen/typescript”: “2.7.2”
- “@graphql-codegen/typescript-resolvers”: “2.7.2”
Codegen Config File
No response
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The reason why the
offset
is nullable.Kind
is import fromgraphql
If user pass null as argument explicitly, it can be
null
, so it works as it should be. See #8129