-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add Kotlin reflection support to ModelOptionsUtils
#1667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, I have some question regarding this issue, please clarify follow points:
|
Hi, thanks for your feedback. I think conceptually the goal is to infer if a property is required or not, so I think I would consider both nullable properties and properties with default value as non required, and the other ones as required. So for your 2 examples, only For functions, I think that's outside of the scope of this issue. It could make sense to use Kotlin reflection instead of Java one to support more advanced Kotlin constructs, but so far I don't think there is advanced need for optional parameters with default values as only |
Resolved by 756a9dc |
Thanks, will send the documentation refinement PR tomorrow. |
See #2006 related PR. |
Uh oh!
There was an error while loading. Please reload this page.
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: