Open Shadowell opened 5 years ago
I don't really "integrate" with SpringBoot. I've successfully used SB in projects. I have an example project doing just that at https://github.com/jpbelang/BeerTrader.
I don't really "integrate" with SpringBoot. I've successfully used SB in projects. I have an example project doing just that at https://github.com/jpbelang/BeerTrader.
Hey!
I have seen that you have used uppercased letters for the enum declarations in your example. I is that intended? I am having problems with some of the default example RAML apis (eg.: the jukebox) using lower cased enum definitions. At runtime Jersey is having obvious problems not finding the enum constant:
Generated java code with lower cased enum def:
@XmlEnum
public enum AlbumsAlbumIdSongsGetOrder {
@XmlEnumValue("desc")
@JsonProperty("desc")
DESC("desc"),
@JsonProperty("asc")
@XmlEnumValue("asc")
ASC("asc");
private String name;
AlbumsAlbumIdSongsGetOrder(String name) {
this.name = name;
}
}
And the generated api looks like this:
@GET
@Produces("application/json")
GetAlbumsResponse getAlbums(@QueryParam("query") String query,
@QueryParam("orderBy") String orderBy,
@QueryParam("order") @DefaultValue("desc") @Valid AlbumsGetOrder order,
@QueryParam("offset") @DefaultValue("0") int offset,
@QueryParam("limit") @DefaultValue("10") int limit);
And this will cause a runtime error:
java.lang.IllegalArgumentException: No enum constant com.example.AlbumsAlbumIdSongsGetOrder.desc
Also I have not found any bugs / issues regarding this java codegen problem. Have you ran into this?
Not too sure, but from a serialization perspective, it seems to work. I've put an example for it in the tool project. I'll check for the @DefaultValue.
My raml file looks like this:
%RAML 1.0
title: Book API baseUri: http://api.datiip.com/ version: v1 types: User: type: object properties: name: type: string telephone: type: number age: type: number minimum: 0 maximum: 150 ResponseEntity: type: object properties: code: number message: string
/auser: get: responses: 200: body: application/json: type: User 500: body: application/json: type: ResponseEntity post: responses: 200: body: application/json: type: ResponseEntity
This is the endpoint interface file that I got: @Path("/auser") public interface Auser { /* / @GET @Produces("application/json") GetAuserResponse getAuser();
/* / @POST @Produces("application/json") PostAuserResponse postAuser();
class GetAuserResponse extends ResponseDelegate { private GetAuserResponse(Response response, Object entity) { super(response, entity); }
}
class PostAuserResponse extends ResponseDelegate { private PostAuserResponse(Response response, Object entity) { super(response, entity); }
} }
How can I inherit such interfaces to write my own implementation logic flexibly, please give me a demo with spring boot integrated.
Thank you very much!