Support for default schema values
See original GitHub issueThe GraphQL spec allows for arguments to have default values:
Kotlin allows specifying default values:
This information is not available on reflection though due to the way Kotlin compiles to the JVM:
- https://discuss.kotlinlang.org/t/kotlin-reflection-and-default-values/2254
- https://discuss.kotlinlang.org/t/retrieve-default-parameter-value-via-reflection/7314
We could solve this issue by adding a new annotation @GraphQLDefaultValue
. This would require developers to duplicate some information but I think it would be worth it until we have a better way of extracting the info
fun getWidget(id: Int, @GraphQLDefaultValue(WidgetType.UNICORN) type: WidgetType = WidgetType.UNICORN) {
return database.getWidgetByIdAndType(id, type)
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Default value | Opis JSON Schema
You can specify a default value for an item using the default keyword. When a data doesn't have a corresponding value, the value...
Read more >How Does a Schema Support Default Fields or NULL Fields?
To enable the schema generated based on the JSON data sample supports the default value or null, select the Convert and Move and...
Read more >Setting default values in data schema - MongoDB
Hello Enthusiast, I am implementing data schema. Here i have to mention default value to a field of document.
Read more >Setting default values in the schema of a component in a Job
Note: At present, only tFileInputDelimited, tFileInputExcel, and tFixedFlowInput support default values in the schema. In the following example, the company ...
Read more >Generic keywords — Understanding JSON Schema 2020-12 ...
The default keyword specifies a default value. This value is not used to fill in missing values during the validation process. Non-validation tools...
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
@keerthi4308 Feel free to propose a solution or provide a PR! This is not being worked on by someone today so you can assign yourself if you would like.
As you can see from the previous discussion there is a bit of complexity on the best way to solve it
I’m wondering if this issue is taken care by anyone? I would like to contribute to this repo.