Hi,

after generating the server stub for my jee test application based on 
RESTEasy with codegen the generated swagger.json just shows:

{"swagger":"2.0"}



When I checked the generated server stub I noticed that the swagger 
annotations are missing. This is also the case with the petstore when 
exporting the stub with the swagger-editor. When generating for the default 
JAX-RS (Jersey), the code does include the annotations. For Example:

*CustomerApi.java - JAX-RS RESTEasy*

@Path("/customers")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@javax.annotation.Generated(value = "class 
io.swagger.codegen.languages.JavaResteasyServerCodegen", date = 
"2016-12-21T08:42:36.363Z")
public class CustomersApi {
private final CustomersApiService delegate = 
CustomersApiServiceFactory.getCustomersApi();


@POST

@Consumes({ "application/json" })
@Produces({ "application/json" })
public Response addCustomer( NewCustomer customer,@Context SecurityContext 
securityContext)
throws NotFoundException {
return delegate.addCustomer(customer,securityContext);
}


*CustomerApi.java - JAX-RS (Jersey)*

@Path("/customers")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.Api(description = "the customers API")
@javax.annotation.Generated(value = "class 
io.swagger.codegen.languages.JavaJerseyServerCodegen", date = 
"2016-12-21T09:06:25.420Z")
public class CustomersApi {
private final CustomersApiService delegate = 
CustomersApiServiceFactory.getCustomersApi();


@POST

@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "", notes = "Creates a new 
customer in the store. Duplicates are allowed", response = Customer.class, 
tags={ })
@io.swagger.annotations.ApiResponses(value = { 
@io.swagger.annotations.ApiResponse(code = 200, message = "customer 
response", response = Customer.class),

@io.swagger.annotations.ApiResponse(code = 200, message = "unexpected 
error", response = Customer.class) })
public Response addCustomer(@ApiParam(value = "Customer to add to the 
store" ,required=true) NewCustomer customer
,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.addCustomer(customer,securityContext);
}


After checking the templates I found out that there is no swagger 
annotation definition in the RESTEasy templates at all. Is this by design 
or a bug? If this is by design, how is Swagger is indexing the services? 
Unfortunalty I was not able to find any information on that.

Thanks
Markus

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to