mp
07/03/2018, 10:43 AMname=null
or description=null
, processing fails onto json MissingKotlinParameterException: Instantiation of [simple type, class com.norselab.ivaldi.model.category.Category] value failed for JSON property name due to missing (therefore NULL)
but if missed optional (not description=null, but missed in request from client) field - it instantiated from default value, in the same if missed required field also comes miss json error and status 500, but probably good is to have status 400
Is this expected behavior? Or I have miss configuration or even miss understanding
data class Category(
val externalId: String = UUID.randomUUID().toString(),
val name: String,
val description: String = "",
val parent: String = ""
)
class Controller {
@PostMapping("")
fun createCategory(@RequestBody newCategory: Category) {}
}
or this is bad practiceEvgeniy Zaharov
07/03/2018, 10:51 AMmp
07/03/2018, 10:52 AMEvgeniy Zaharov
07/03/2018, 10:59 AMEvgeniy Zaharov
07/03/2018, 11:04 AM