Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Methods specific annotations #2

Open
sorenmalling opened this issue Mar 20, 2023 · 8 comments
Open

HTTP Methods specific annotations #2

sorenmalling opened this issue Mar 20, 2023 · 8 comments

Comments

@sorenmalling
Copy link
Contributor

sorenmalling commented Mar 20, 2023

How about we introduce HTTP specific Route annotation, making it a bit more simple

Today

#[Route('', method: 'POST')]

Tomorrow

#[Route\Get(format: 'json')]
#[Route\Post('')]
@mhsdesign
Copy link

i mean its not the symphony way: https://symfony.com/doc/current/routing.html but it sure looks cool.
Btw we can tell phpstorm which arguments to expect for the current method parameter too: neos/flow-development-collection#2961 that would be easy too ^^

@bwaidelich
Copy link

In Routes.yaml we call it "httpMethods" and allow multiple methods per route, I would suggest:

#[Route(httpMethods: ['POST'])]

@sorenmalling
Copy link
Contributor Author

In Routes.yaml we call it "httpMethods" and allow multiple methods per route, I would suggest:

#[Route(httpMethods: ['POST'])]

We allow both array and string

https://github.com/wbsply/route-annotation/blob/main/Classes/Annotations/Route.php#L16

@sorenmalling
Copy link
Contributor Author

i mean its not the symphony way: https://symfony.com/doc/current/routing.html but it sure looks cool. Btw we can tell phpstorm which arguments to expect for the current method parameter too: neos/flow-development-collection#2961 that would be easy too ^^

Like this (no changes, does by default)

image

@mhsdesign
Copy link

no but we can also tell which values are allowed ;) see what was done in neos/flow-development-collection#2961

(or maybe even phpdoc is now far enough to be able to tell this the ide?)

@lorenzulrich
Copy link

No strong opinion here, but in general it would be nice to allow more than one method.

@sorenmalling
Copy link
Contributor Author

No strong opinion here, but in general it would be nice to allow more than one method.

@lorenzulrich Not relevant to the original goal of this "issue" :) And you can already use a array of HTTP methods

#2 (comment)

@mficzel
Copy link

mficzel commented Mar 23, 2023

I think beeing as close to the routing configuration as sensible is a good idea.

So for me #[Flow\Route(httpMethods:[“get”]…)]

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

No branches or pull requests

5 participants