cy
02/20/2020, 12:19 PM@Location("/api/{version}")
class Api(val version: Int) {
@Location("/user/{id}")
class User(val id: String, val api: Api = Api(1)) {
// here API presence looks required,
// otherwise, there is no way to find a version value
// so now we demand the api parameter to exist
}
}
The other point is that one can't just move a nested class outside without additional manual changes:
@Location("/root")
class Outer {
@Location("/child")
class Child // it is tied to /root/child path
}
@Location("/child")
class Child // this is tied to just /child
@Location("/child2")
class Child2(val outer: Outer) // -> /root/child2
The cause of the second change is that objects should be symmetric with classes, and one can't add a constructor property to an object. The unfortunate consequence is that one can't write like this anymore:
@Location("/api")
object Api {
@Location("/info")
object Info
}
Should be migrated to the following:
@Location("/api")
object Api {
@Location("/info")
class Info(val api: Api = Api)
// the api parameter is required, weird isn't it
}
The question is: do these changes affct many, does anybody use structured locations with nested objects?spand
02/20/2020, 12:35 PMcy
02/20/2020, 12:44 PMchristoph.pickl
02/20/2020, 12:44 PMcy
02/20/2020, 12:47 PMcy
02/20/2020, 12:49 PMspand
02/20/2020, 1:02 PMchristoph.pickl
02/21/2020, 8:45 AM