将 Enunciate 与 Grails 一起使用
我正在以 RESTful 方式创建 Web API。 Grails 当然对创建 REST Web 服务有很好的支持。 阐明 声称在 API 部分提供帮助,其中文档、客户端库等内容很重要。
这篇文章的目的是邀请大家体验使用 Enunciate with Grails 的经验,或者关于如何做到这一点的想法。
将它们一起使用有两个主要问题:
Enunciate 与 JAX-RS 一起使用,而不是 Grails 的 REST 的本机实现。值得庆幸的是,有一个 JAX-RS 插件可用,但我不确定 Enunciate 是否能够使用它。
Grails 域类位于 Groovy 中,而 Enunciate 则适用于 Java 源代码(示例)。
I am creating Web APIs, in a RESTful manner. Grails of course has good support for creating REST web services. Enunciate claims to help in the API part, where things like documentation, client libraries, etc are important.
The purpose of this post is to invite experiences on using Enunciate with Grails, or ideas on how that can be done.
There are two main issues using them together:
Enunciate works with JAX-RS, not the native implementation of REST by Grails. Thankfully there's a JAX-RS plugin available, but am not sure if Enunciate will be able to work with it.
Grails domain classes are in Groovy while Enunciate works with Java
source code (example).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Enunciate 使用 Java 源代码和 Java 编译字节码来完成其工作。但如果您没有 Java 源代码,Enunciate 将无法从 JavaDoc 中提取内容来增强其生成的文档。鉴于此,(理论上)应该有一种方法将 Enunciate 应用于已编译的 Groovy 字节码,但您的文档不会那么丰富,因为 Enunciate 将无法查看您的 JavaDoc 文档。我说理论上是因为我没有任何个人经验,也不知道实现起来有多痛苦。
ENUNCIATE-356 上有一个未解决的问题来调查这种复杂性。请注意,ENUNCIATE-356 取决于 ENUNCIATE-584,可能很快就会受到更多关注,由 ENUNCIATE-585 当我们从使用 APT(在 Java 5 中引入,在 Java 7 中已弃用)转向Javac 工具(在 Java 6 中引入)。了解 Javac 工具是否支持 Java 以外的语言将会很有趣,在这种情况下我们将免费获得 Groovy 支持。
Enunciate works with both Java source code and Java compiled bytecode to do its work. But if you don't have Java source code, Enunciate won't be able to pull stuff out of your JavaDocs to enhance its generated documentation. Given that, there should (theoretically) be a way to apply Enunciate to compiled Groovy bytecode, but your docs won't be as rich because Enunciate won't be able to see your JavaDoc documentation. I say theoretically because I don't have any personal experience with it nor do I know how painful it is to pull off.
There is an open issue at ENUNCIATE-356 to investigate this complexity. Note that ENUNCIATE-356 depends on ENUNCIATE-584, which might get some more traction soon, being driven by ENUNCIATE-585 as we move from using APT (introduced in Java 5, deprecated in Java 7) to the Javac tool (introduced in Java 6). It would be interesting to know whether the Javac tool supports languages other than Java, in which case we'd get Groovy support for free.