Scott Shidlovsky
09/05/2018, 4:50 PMdata class NameRequest(@field:NotNull val firstName: String, @field:NotNull val lastName: String)
But when making the request, I get a 500 server error. java.lang.IllegalArgumentException: Parameter specified as non-null is null: method NameRequest.<init>, parameter firstName", Do all fields have to be marked nullable? I used the spring starter for kotlin which contains the kotlin-jackson dependency.fred.deschenes
09/05/2018, 4:53 PM@get:TheAnnotation theField
diesieben07
09/06/2018, 7:35 AMString
in Kotlin, the Kotlin compiler will add a check in the constructor that the passed in value is not null and throw an exception instead (the one you are seeing). Yes, if you want it to be possible for the field to hold null
values, then you need to mark it String?
.Scott Shidlovsky
09/10/2018, 2:52 PM