Skip to content

Conversation

@bblommers
Copy link
Contributor

Motivation

When using the RouterHandler, Rolo expects the response of individual routes to be a Response object.

However, when used in conjunction with a serializer like the ASF, individual routes sometimes return a custom object that requires additional serialization down the line.

This PR introduces a custom converter at the RouterHandler-level, so that individual routes can continue to return custom objects, and the serialization step (/conversion to a rolo.Response-object) is centralized in a single utility function.

@bblommers bblommers requested a review from thrau July 24, 2025 11:19
@thrau
Copy link
Member

thrau commented Jul 24, 2025

hey @bblommers ! can you show me an example of this? i'm open to the idea, conceptually though it should already be covered by custom dispatchers, but i may be missing something, so just would like to see a clarifying practical example in localstack first.

@bblommers
Copy link
Contributor Author

Further discussion on Slack cemented the idea that we (I) should handle this in a custom dispatcher, as the current solution is the wrong abstraction level.

@bblommers bblommers closed this Jul 25, 2025
@thrau
Copy link
Member

thrau commented Jul 25, 2025

thanks @bblommers, appreciate you reaching out and taking the time to explore other solutions!

as discussed, my main issue was that the solution was too specific to the RouterHandler and not native to the Router. the intended way of solving a problem like this is to write a custom dispatcher. however, i conceded that this is a bit difficult given that the router object bert is working with is the gateway ROUTER object of localstack, which already has a dispatcher.

my suggestion was to write a custom dispatcher and then replace or wrap the dispatcher of ROUTER with that dispatcher that knows how to serialize MSF response objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants