Implementing APIs with the visitor pattern
I want to leverage my visitor pattern source generator to implement a simple minimal api.
I aim to:
- Have a request and a request handler for my endpoint. I will not use mediatr or any similar library and I will not use any real storage, only some in memory data structure to showcase the visitor pattern approach.
- The request handler
Handle
method returns an interface, every subtype represents a different type of result, a success, and one type for each error (provided) emitted by the handled. - For each subtype we want to be able to return a possibly different http response.