stoicflame / enunciate

Build-time enhancement tool for Java-based Web services projects
http://enunciate.webcohesion.com/
Other
481 stars 200 forks source link

support for resteasy multipart data types #594

Open brunohorta82 opened 7 years ago

brunohorta82 commented 7 years ago

Hello

I try use @TypeHint to specify the object but doesn't work :(, i thing it's because @Consumes(MediaType.MULTIPART_FORM_DATA)

@Path("register")
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
@TypeHint(JsonObject.class)
public Response register(@Valid   @TypeHint(PlayerRegistrationRequest.class) PlayerRegistrationRequest playerRegistrationRequest) {
    try {
        repository.register(playerRegistrationRequest.getPlayer(), playerRegistrationRequest.getThumbnail());
        return Response.ok().status(Response.Status.OK).entity(Json.createObjectBuilder().add("registration", "success").build()).build();
    } catch (RegistrationException e) {
        return ResponseTemplate.constructBadRequestResponse(e);
    }
}

The output is screen shot 2017-02-01 at 11 32 46

stoicflame commented 7 years ago

What tool is converting the multipart/form-data to an instance of PlayerRegistrationRequest?

Unless I'm mistaken, JAX-RS doesn't have a standard converter for that. So Enunciate doesn't know how to display PlayerRegistrationRequest as a data type.

brunohorta82 commented 7 years ago

screen shot 2017-02-01 at 15 50 39

stoicflame commented 7 years ago

What's the @PartType annotation.

brunohorta82 commented 7 years ago

screen shot 2017-02-01 at 16 19 19

stoicflame commented 7 years ago

Okay. So this is a request to support resteasy-proprietary multipart (de)serialization.

brunohorta82 commented 7 years ago

Okay, you can fix this? :)

stoicflame commented 7 years ago

Sure, it's possible to do, but it's probably not a high priority at the moment.

brunohorta82 commented 7 years ago

ok thanks

stoicflame commented 7 years ago

This enhancement is currently seeking a sponsor. If anybody is willing to sponsor the work, reach out to me and I'd be happy to pick it up.