Moreover, if I make the fields non-nullable like t...
# getting-started
p
Moreover, if I make the fields non-nullable like this:
Copy code
data class GreetingDto(
  val greeting: String,
  val name: String
)
then I get another error:
groovy.lang.GroovyRuntimeException: Could not find matching constructor for: app.greeting.GreetingDto(LinkedHashMap)
j
Not a Groovy expert, but I think you’re trying to pass a map as argument (which is Groovy’s approximation for named parameters). My guess is that just passing positional parameters should work:
return new GreetingDto("Hello", "World")
t
^^ This is 100% correct
p
Thank you guys, it works