kbuntrock / openapi-maven-plugin

Generate openapi documentation for SpringMVC or JaxRS/JakartaRS projects.
https://kbuntrock.github.io/openapi-maven-plugin/
MIT License
13 stars 8 forks source link

Use custom DTO as body param #103

Closed royteeuwen closed 6 months ago

royteeuwen commented 6 months ago

I'm trying to use a custom DTO as body param using jakarta.ws.rs, but I get the message Execution documentation of goal io.github.kbuntrock:openapi-maven-plugin:0.0.17:documentation failed: Type ? super T (+WildcardTypeImpl) is not supported yet.

Is there anything I can change in my example to make it work? Looking at the docs it seem like something that should work

An example class would be

import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;

import java.io.IOException;

@Path("/create")
public class CreateServlet {

    @POST
    @Path("")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response post(@QueryParam("path") String path,
                         Input input) throws IOException {
        return new Response("success");
    }

    public class Input {
        private String title;
    }

    public static class Response {
        private final String status;

        public Response(String status) {
            this.status = status;
        }

    }

}
kbuntrock commented 6 months ago

Hello.

Your code looks normal.

Are you using version 0.0.17?

If yes, I suspect you are in presence of a bug linked to generic type resolution (can be in the controller or an object given as input or output). In that case, can you provide a minimal example reproducing the bug?

royteeuwen commented 6 months ago

Not sure where it went wrong, but after trying it again, it now works! maybe because of upgrading to 0.0.17 :)

kbuntrock commented 6 months ago

@royteeuwen : Alright, no worries. Don't hesitate to re-open the ticket if it's shows up again.