-
Notifications
You must be signed in to change notification settings - Fork 86
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
Generate default @Path("/") annotation for client methods #536
Comments
Thanks for opening the issue, @gh-nalo. So if I understood correctly, you need the generated code to look like this: @Path("/someMethod")
@RegisterRestClient( configKey="someFile_json")
@GeneratedClass(value="someFile.json", tag = "Default")
@ApplicationScoped
public interface DefaultApi {
@POST
@Path("/")
@GeneratedMethod ("someMethod")
public javax.ws.rs.core.Response someMethod(
);
@POST
@Path("/{id}")
@GeneratedMethod ("someMethodId")
public javax.ws.rs.core.Response someMethodId(
);
} Not sure what the implications are for others. I'm curious about your setup. Why is this not working without the trailing slash at the end? What kind of redirects do you have on your server? |
@ricardozanini |
@ricardozanini |
@michalsomora @gh-nalo feel free to open a PR. |
…ourceOperation' is empty
@ricardozanini |
Shouldn't it be possible to detect that the original URL has a slash ad the end, and THEN add the @path("/")? That way, it should only be added when this edge case occurs. Cases where the original URL don't have the slash at the end with then not get one for free unexpectedly. |
@ractoc feel free to take a look at the current PR #585. Not sure if @jeffersoncleyson will continue working on it. |
Are there some news to this issue? I have a similar problem. The external api server responds with 404 if the trailing slash is missing. Bad practice, I think. Is there some solution in next time or a workaround? Thanks. |
@wernert75 there's no workaround at the moment. Feel free to send a PR based on #585. |
Using the openapi-generator has caused some minor issues in our application with redirecting calls, because the trailing "/"-slash is missing at the end of requests when there is more than one path defined in the OpenApi spec.
Example 1 - For the following Json:
this file is generated:
here the
@POST
has the trailing slash due to "/someMethod/" on class level.Example 2 - But in this case:
which creates
The first POST is now missing the "/" at the end after adding another endpoint with - for example - a query parameter.
Would it be possible to add a default
@Path("/")
annotation here for the base-methods?The text was updated successfully, but these errors were encountered: