https://kotlinlang.org logo
Title
r

ribesg

04/06/2022, 11:46 AM
Is there a “road to no longer experimental” task/issue I can follow for Ktor Locations?
a

Aleksei Tirman [JB]

04/06/2022, 11:52 AM
In the Ktor 2.0.0, a new plugin is called Resources.
r

ribesg

04/06/2022, 12:04 PM
Oh. So Locations are dropped and replaced by this
a

Aleksei Tirman [JB]

04/06/2022, 12:20 PM
Yes
👍 1
d

Dirk

04/06/2022, 2:22 PM
Is it planned that more than just two levels will be supported by the plugin in the future?
a

Aleksei Tirman [JB]

04/06/2022, 6:00 PM
What levels are you talking about?
d

Dirk

04/07/2022, 8:29 AM
I had misinterpreted the requirement here that the parent must be listed in the constructor. Therefore I had included both the parent and grandparent in the third level, but this is not necessary and leads to an exception. So it was my mistake and it now works with more than two levels.
@Serializable
@Resource("/a")
class A {
    @Serializable
    @Resource("b")
    class B(val parent: A = A()) {
        @Serializable
        @Resource("c")
        class C(val parent: B = B())
        // Does not work...
        // class C(val parent: B = B(), val grandparent: A = A())
    }
}