[英]Can Enunciate generate docs for an API that handles generic types?
Given an abstract, generic Resource class and a concrete implementation: 给定一个抽象的,通用的Resource类和具体的实现:
public abstract class AbstractResource<T> {
@Autowired
private SomeService<T> service;
@Path("/{id}")
@GET
public T get(@PathParam("id") String id) {
return service.get(id);
}
}
@Path("/people")
public class PersonResource extends AbstractResource<Person> { }
It appears that when generating the docs for PersonResource
, Enunciate is not picking up the fact that get()
returns a Person
. 看来,在为
PersonResource
生成文档时,Enunciate没有发现get()
返回Person
的事实。
Person is not listed in the Data Model > Data Types section. Person未列在“数据模型”>“数据类型”部分中。
Under the GET section, Response Body shows the element type as "(custom)". 在GET部分下,Response Body将元素类型显示为“(custom)”。
Are these issues because of the use of generics as the entity types? 这些问题是因为使用泛型作为实体类型吗? Is there a way to hint to Enunciate what the real types are so the documentation can be generated correctly?
有没有办法提示发音真实类型是什么,以便正确生成文档?
Is Person
annotated as @XmlRootElement
? Person
是否注释为@XmlRootElement
? If so, is it included in the same project as PersonResource
? 如果是这样,它是否与
PersonResource
包含在同一个项目中? If not, are you importing the Person
class as described in Enunciate: Multi-Module Projects ? 如果没有,您是否按照Enunciate:Multi-Module Projects中的描述导入
Person
类?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.