schema generator should fail if input types with nullable fields do not define a default value
See original GitHub issueDiscussed in https://github.com/ExpediaGroup/graphql-kotlin/discussions/1525
<div type='discussions-op-text'>Originally posted by Anthonyzou August 22, 2022 With the changes in version 6.2.0 and above, input types that could be nullable did not require a default value.
This code would work before version 6.2.0
@GraphQLDescription("")
data class Book(
val title: String?
)
Now I get the error No argument provided for a required parameter: parameter #0...
unless I change the input type to:
@GraphQLDescription("")
data class Book(
val title: String? = null
)
```</div>
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Inconsistent behavior for defaultValue and nullable on input ...
A field in an input type or argument list is set to nullable: true , if a default is provided, even when the...
Read more >Using nullability in GraphQL
A field can either be nullable or non-null, and this tells you whether or not you could receive a null value when you...
Read more >Problems with adding NOT NULL columns or making nullable ...
I need to add a new column, make it non-NULL, but not provide a permanent default value - the users should always fill...
Read more >use of "default" in avro schema - Stack Overflow
Schema says that: if "age" field is missing, then consider value as -1. Likewise for "name" field. Now, if I try to construct...
Read more >Nullability - GraphQL Nexus
When you make an input nullable then Nexus will alter its TypeScript type ... is for the case where the client simply did...
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 FreeTop 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
Top GitHub Comments
we can add more custom logic here https://github.com/ExpediaGroup/graphql-kotlin/blob/master/generator/graphql-kotlin-schema-generator/src/main/kotlin/com/expediagroup/graphql/generator/hooks/SchemaGeneratorHooks.kt#L144
adding this logic when unwrapped is
GraphQLInputObjectType
@xenomachina i would assume you did it in the
didGenerateGraphQLType
hook ?released https://github.com/ExpediaGroup/graphql-kotlin/releases/tag/6.2.2