rs-用于嵌套资源(子资源)的openapi生成器(java,jax-rs)

44u64gxh  于 2021-06-29  发布在  Java
关注(0)|答案(0)|浏览(180)

是否可以使用openapi生成器生成嵌套资源(子资源)?我们的想法是使用一些yaml文件来生成正确的资源和子资源文件。像这样:

@Path("resource")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class SomeResource {
   @Inject
   ResourceService resourceService;

   @GET
   @Path("{id}")
   public Response getResource(@PathParam("id") String id) {
      resourceService.getResource(...)
      return Response... 
   }
   ... other POST, PUT, DELETE

   @Path("{id}/sub-resource")
   public Response subResource(@PathParam("id") String id) {
      return new SubResource(...);
   }
}

class SubResource {
  // endpoints 
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题