Ask a Question

Combining @Path Annotations

Occasional Visitor

Combining @Path Annotations



I'm having an issue with Swagger Annotations not picking up the combined Path annotations between a class with a defined Path annotation that calls and returns another class, which also continues the endpoint path through its own class Path annotation.  This latter class has multiple endpoints with their own Path annotations as well.  For example (Java):



public class FirstClass {


   public SecondClass getSecond(@PathParam("first") FirstId firstId) {

      return new SecondClassImpl(firstId);




public interface SecondClass {




   List<SecondClass> getRelatedMaps(@PathParam("first") FirstId firstId, @PathParam("second") SecondId secondId);



The generated definition file of course shows the path of this service as /second/{second}/related/maps, however the server sees it as /first/{first}/second/{second}/related/maps.  In other words, when calling the service from a browser directly, the full path works fine.  However, when calling the service from the swagger UI page, it can't find it due to the incorrect shortened path.  So my question is, is there a way to append "/first/{first} to the second part of the path using the @Operation annotation, for example?  We're using OpenApi 3.0.


Thank you. 

Showing results for 
Search instead for 
Did you mean: