1

Suppose I am setting up my transformers and need to handle two similar API routes that return different object schemas, e.g.

/beers/{id}               -> [Beer]
/beers/grouped-by-country -> [Country:Beer]

It seems Siesta is unable to distinguish in this type of case, because the path matching only supports basic glob. So the best we can do is

service.configureTransformer("/beers/*") { ... }
service.configureTransformer("/beers/grouped-by-country") { ... }

And of course, /beers/* will also match /beers/grouped-by-country, so it will try to parse the response into the wrong object type.

Is there a way to distinguish the routes in this case?

0 Answers0