mulesoft-labs / raml-for-jax-rs

This project is all about two way transformation of JAX-RS-annotated Java code to RAML API description and back.
Other
296 stars 181 forks source link

Resource interface with generated return types instead of Response #410

Open coenvl opened 4 years ago

coenvl commented 4 years ago

I am using the raml-to-jaxrs plugin to generate code for both a server and a client. However, I am having some difficulty to create the client code. Partially this is because the functions of the interfaces do not return the actual return types, but a response object wrapped around the return entity.

Is it possible to generate the interfaces where the return types are from the generated model classes? This could be used by the client, but also by a jersey server.

I tried looking at raml-to-pojo, but I found it does not generate any interfaces for the resource locations, and even if it would, I suppose it would not annotate them with the jax-rs annotations, since I still do need those.

What I did come up with is use the generated server code at the client side, and use reflection to figure out what "respond200WithXXX" builder I should use. This does create a valid response object, but then still I end up with an OUTbound response which is of no use for the client.

jpbelang commented 4 years ago

Just adding something for the command line and a quick example. This should be closed today