Defaulting values do not work when using it on child objects
See original GitHub issueLibrary Version graphql-kotlin-spring-server version “6.1.0” org.springframework.boot version “2.7.2”
Describe the bug When using a default argument for a child object, the default parameter is given “null” instead of a default value.
To Reproduce Steps to reproduce the behavior. Please provide: For a depth of 1
@Component
class DefaultValueQueryDepth1 : Query {
suspend fun returnTrueIfModelValueDefaults(queryModel: QueryModel?): Boolean {
return queryModel?.value == "defaultValue"
}
}
data class QueryModel(val value: String? = "defaultValue")
For a depth of 2
@Component
class DefaultValueQueryDepth2 : Query {
suspend fun returnTrueIfChildValueDefaults(parentQueryModel: ParentQueryModel): Boolean {
return parentQueryModel.childQueryModel?.value == "defaultValue"
}
}
data class ParentQueryModel(val childQueryModel: ChildQueryModel? = ChildQueryModel("defaultValue"))
data class ChildQueryModel(val value: String? = "defaultValue")
Please also see the following repo for the bug : https://github.com/JustinSchwarzwald/GraphQLDefaultingValuesBug
Expected behavior The child object should receive the default value that is specified.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Set default value on children records when `New` is clicked on ...
A default value will not work in this case, because default values can't access values on a parent record. They are set at...
Read more >Defaulting in values from a parent ... - Salesforce Developers
It seems that newly created child objects do not have access to parent object values. This is absolutely essential.
Read more >defaults() leaves child objects null · Issue #28344 - GitHub
I understand this is by design: Terraform will recursively visit all of the attributes or elements of the nested value and repeat the...
Read more >Python: Child Inheriting Parents Default Values If Not Specified
So I'm either having issues with my inheritance (I'm really struggling with Super), or the signatures of my objects, and I'm not quite...
Read more >Inheritance and the prototype chain - JavaScript | MDN
It should not be confused with the func.prototype property of functions, which instead ... The child object now looks like: // { value:...
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
https://github.com/ExpediaGroup/graphql-kotlin/releases/tag/6.2.0
@cryptoki We will release a minor version in the following days.