dave
04/23/2019, 4:18 AMNezteb
04/23/2019, 3:18 PM/users which has like 12 routes on top of it
/organizations which has 10
/workspaces that has 10
And I could make one giant chain of
routes += ... * 32
But I was hoping to do that only 3 times and have each of those nested route sets in separate files, but still produce a single Swagger filedave
04/23/2019, 3:23 PMdave
04/23/2019, 3:26 PMNezteb
04/23/2019, 3:27 PMNezteb
04/23/2019, 7:27 PM"/api/v1" bind contract {
renderer = OpenApi(ApiInfo("My great API", "v1.0"), Jackson)
descriptionPath = "/swagger.json"
security = AuthSecurity(::authFilter, contexts)
for (route in organizationsRoutes) {
routes += route(contexts)
}
},Nezteb
04/23/2019, 7:28 PMRequestContexts object, this is the only way i could find to do itdave
04/23/2019, 7:32 PM(RequestContext) -> ContractRoute? looks fair enoughdave
04/23/2019, 7:34 PMroutes.map { it(contexts) }Nezteb
04/23/2019, 7:37 PMNezteb
04/23/2019, 7:38 PMroutes doesn’t seem to have a .map optionNezteb
04/23/2019, 7:38 PMAppendable doesn’t inherit from any of the standard Kotlin collection typesdave
04/23/2019, 7:39 PMdave
04/23/2019, 7:40 PMroutes += organizationsRoutes.map { it(contexts) }dave
04/23/2019, 7:40 PMoperator fun plusAssign(t: Collection<T>) { all += t }) 🙂dave
04/23/2019, 7:45 PMlistOf(::addOne, ::addTwo, ::addThree).fold(1, { acc, next -> next(acc) })Nezteb
04/23/2019, 7:50 PMNezteb
04/23/2019, 7:51 PM.map had a it availabledave
04/23/2019, 7:53 PMdata class Age(val i: Int)
val ages: List<Age> = listOf(1, 2, 3).map(::Age)dave
04/23/2019, 7:53 PM