I have looked at this Grails get child domain objects but I am still lost.
I have added to conf/application.yml
converters:
encoding: UTF-8
grails.converters.json.default.deep: true
But when I do a get on a domain, I still get
[~]$ curl http://localhost:8080/request/2 {"id":2,"stream":{"id":2},"release_label":"ABC_4.3","date_created":"2017-08-21T13:06:27Z","envs":[{"id":1}],"status":"init"}
I want stream and envs to be expanded to give all of the records, not just the id.
So Request,groovy is
And Stream.groovy is
package test
import grails.rest.*
class Stream {
String name
String feedgroup
String description
UnixGroup unixgroup
String swid
boolean powercentre = false
String latest_release
static hasMany = [envs: Env]
static constraints = {
name blank:false, unique: true
}
}
package test
import grails.rest.*
class Request {
Date date_created = new Date()
Date date_completed
String status = "init"
String release_label
Stream stream
static hasMany = [envs: Env]
static constraints = {
date_completed nullable: true
}
static searchable = {
only = [ 'stream', 'status' ]
}
}
I am using Grails 3.30.
Is grails.converters.json.default.deep still valid for Grails 3? And how do I use it.