You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As documented via #1666, schema generation from Kotlin classes currently requires using non idiomatic
code like data class Foo(@get:JsonProperty(required = true, value = "output") val bar: String) while the required information can be inferred from Kotlin null-safety and the value inferred from Kotlin reflection.
A related com.github.victools.jsonschema.generator.Module instance could be implemented and created when KotlinDetector.isKotlinReflectPresent() == true to provide those information automatically here.
That would allow to perform schema generation with just data class Foo(val bar: String).
The text was updated successfully, but these errors were encountered:
I have some question regarding this issue, please clarify follow points:
In a data class like data class Foo(val bar: String, val baz: String?), should the property baz be not marked as required in the generated JSON schema because it's nullable, even though it doesn't have a default value? Or should it only be considered not required if it has a default value, like in data class Foo(val bar: String, val baz: String? = null)?
Also about properties with default values: How should the module handle non-nullable properties with default values, such as in data class Foo(val bar: String, val baz: Int = 10)?
As documented via #1666, schema generation from Kotlin classes currently requires using non idiomatic
code like
data class Foo(@get:JsonProperty(required = true, value = "output") val bar: String)
while the required information can be inferred from Kotlin null-safety and the value inferred from Kotlin reflection.A related
com.github.victools.jsonschema.generator.Module
instance could be implemented and created whenKotlinDetector.isKotlinReflectPresent() == true
to provide those information automatically here.That would allow to perform schema generation with just
data class Foo(val bar: String)
.The text was updated successfully, but these errors were encountered: