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 POST method naming based on isTargetCollection #211

Closed
yuranos opened this issue Dec 7, 2017 · 3 comments
Closed

HTTP POST method naming based on isTargetCollection #211

yuranos opened this issue Dec 7, 2017 · 3 comments

Comments

@yuranos
Copy link
Contributor

yuranos commented Dec 7, 2017

I am trying to understand why NamingHelper is making a decision about POST method name based on whether the tail is singular or plural.
It's very easy to fix, so I'll gladly do it if it's Ok.
As a result of this issue what we have is:

    @RequestMapping(value = "/{bookingRef}/ogoneIframe", method = RequestMethod.POST)
    public ResponseEntity<OgoneIframeResponseDto> updateOgoneIframe(...)

even though POST should normally be used for creation.
I would understand it if the decision would have been made based on whether the id is present in the url, but it's not the case.

@stojsavljevic , can you take a look and come up with a suggestion?

@stojsavljevic
Copy link
Contributor

Hi.

This is done on purpose.
The reasoning behind this is that endpoints names should be in plural.
In case of singular name we consider that the resource can be only one. So in that case we don't generate method for creating new resource but to update the existing one.

@stojsavljevic
Copy link
Contributor

Continuing the discussion form the PR...

This feature was point of confusion for a number of times.
And I tend to agree with you that we need more flexibility to cover different use cases and different approaches to model REST API.

Before we continue on this let's first finish #212 since there are changes in NamingHelper in both PRs.

@yuranos
Copy link
Contributor Author

yuranos commented Dec 22, 2017

@stojsavljevic , please check the PR now.

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

No branches or pull requests

2 participants