Skip to content

Conversation

@mauroservienti
Copy link
Member

@mauroservienti mauroservienti commented Mar 12, 2021

Fix #148

PoA

@mauroservienti
Copy link
Member Author

Combining attribute routing

image

@mauroservienti mauroservienti added the enhancement Enhancement to existing features label Mar 15, 2021
@mauroservienti
Copy link
Member Author

@markphillips100 technically speaking ddf2378 is a breaking change which should be released as 2.0.0, I see no issues in postponing this to the next major release; with the current design of handlers is gives no benefits at all.

@mauroservienti
Copy link
Member Author

mauroservienti commented Mar 15, 2021

Scratch #278 (comment) Mark, the forward "/" has to be trimmed from the template. I do really need to dive a bit in the way they do it, I'm spending too much time guessing.

@markphillips100
Copy link

That's fine @mauroservienti . No rush. I'll add my 2 cents but I could be missing something of course.

In terms of the "/" usage pattern, as far as I am aware the existence of an "/" or "~/" at the start of an action's route (or route verb) only serve to inform the router whether to prepend the class (controller) route path to the action route. Once that decision is made the actual resulting path is a concatenation of the class and action path just without any "~" or "//". I'd assume you could do the same and strip the leading "/" off this final path if one exists.

The MVC examples show the use of [Route(...)] on actions whereas we've only used http verb attributes. Our usage of http verb attributes implied a 1-to-1 mapping of routes to method. MVC's implies there can be many routes that get directed to the single method.

If we assume that a composition handler should only include methods for the exact same route then I'd assume that changes how endpoints and the composition handler are created and registered with routing. For example, each "discovered" method could result in numerous route paths. Each of these paths needs its own endpoint registration and list of other composition types/methods that also support the specific route path used for the registration, i.e. those other handlers (or subscribers) could also support multiple routes.

It's not a trivial problem for sure.

So I guess another question is, should the package support [Route] on methods in a similar way, or should it be limited to verbs on methods and Route attribute on class only?

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

Labels

enhancement Enhancement to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Users cannot decorate composition handlers with the Route attribute to prefix routes

3 participants