I am trying to use mapstruct to convert my complex dtos on my kotlin project.
mapstruct : 1.3.1.final kotlin: 1.3.71 openapi generator: 4.2.3
For example, i want to convert from a simple object to TestObjectDTO
@Mapping(source = "mydescription", target = "description")
fun convertToDto(dto: TestObject): TestObjectDTO
I use OpenApi to generate my DTO : yaml
components:
schemas:
TestObject:
title: TestObject
description: ''
type: object
properties:
mode:
type: string
description:
type: string
required:
- mode
- description
generated DTO
/**
*
* @param mode
* @param description
*/
data class TestObjectDTO (
@get:NotNull
@JsonProperty("mode") var mode: kotlin.String,
@get:NotNull
@JsonProperty("description") var description: kotlin.String
) {
}
A always have an error, because my constructor does not permit parameterless.
Did you have any idea how to fix this?