I've been playing around with Redstone for a few days and my goal is to write a Redstone based RESTful API.
To accomplish it, I would like to create a simple mechanism responsible to handle API versioning. I'm thinking about creating an annotation like @Version(version:'v1', strategy: 'header') where the version attribute means the version number and strategy means where this version should be found (in this case, in the Accept header).
This annotation should be used at each class annotated with @Group (note that each route is gonna inherit this version). In that case, it's possible to have two or more classes with the same methods, same signatures and paths but belonging to different versions. Look at the two classes below.
@Group(path: '/myPath')
@Version(version: 'v1', strategy: 'header')
class AVersion1 {
@Route(path: 'myRoute')
MyObject get() { ... }
}
@Group(path: '/myPath')
@Version(version: 'v2', strategy: 'header')
class AVersion2 {
@Route(path: 'myRoute')
MyObject get() { ... }
}
With that in mind, I should be able to decide, through a plugin, which route to call (from class AVersion1 or AVersionB). Finally, my question is: is it possible?