如何为春季整合端点创建文档
我使用Springboot 2.2.6
WebApplication使用maven 3
。我还为我的终点使用spring-integration-http
,这意味着我的端点与以下内容相似:
@Bean
public IntegrationFlow test(CommonTransformer<TestDTO, String, TestMapper> testTransformer, Jackson2JsonObjectMapper obj) {
return IntegrationFlows.from(Http.inboundGateway("/foo/{name}")
.requestMapping(m -> m.methods(HttpMethod.GET))
.payloadExpression("#pathVariables.name")
.replyChannel(Constants.REPLY)
.requestPayloadType(String.class))
.transform(testTransformer)
.transform(new ObjectToJsonTransformer(obj))
.channel(Constants.HTTP_REQUEST)
.get();
}
现在我想为我的端点创建一个openapi docs,如果可能的话, SkaggerGUI接口进行测试。
I have read several official/unofficial docs and I find interesting docs
我的关注是,其中许多文章的日期是2020年之前的(例如,其中一种使用不弃用的注释喜欢@enableswagger2MVC
),但我无法设法找到更新的东西。
有人知道一个更加最新的程序吗?
- - - - - - - - - - - - - 更新 - - - - - - - - - - - - ---
首先要感谢@Artembilan的回应。
是的,我阅读了该文章,我对记录我的REST API
并不陌生。使用springdoc-openapi-ui
我能够创建一个.json
文件,如果将其放在某些编辑器中,例如http://swagger.io 或与特定的Maven插件一起使用,可以创建一个可以使用的客户端(在
Spring Java
和Angular
语言中)。
我已经尝试了Springfox的方式(上)来记录我的spring-integration-http
,但很烂!它生成了一些无用的文件来通过卷发复制调用。.
不是我想要的。我必须(sto询问)记录我的终点“ rel =“ nofollow noreferrer”> Swagger Pet Store 。
而且,这种春季融合http
似乎没有办法
。
I'm using a SpringBoot 2.2.6
WebApplication with Maven 3
. I'm also using spring-integration-http
for my endpoint, that's mean that my endpoint are similar to follow:
@Bean
public IntegrationFlow test(CommonTransformer<TestDTO, String, TestMapper> testTransformer, Jackson2JsonObjectMapper obj) {
return IntegrationFlows.from(Http.inboundGateway("/foo/{name}")
.requestMapping(m -> m.methods(HttpMethod.GET))
.payloadExpression("#pathVariables.name")
.replyChannel(Constants.REPLY)
.requestPayloadType(String.class))
.transform(testTransformer)
.transform(new ObjectToJsonTransformer(obj))
.channel(Constants.HTTP_REQUEST)
.get();
}
Now I would like to create a OpenApi docs for my endpoint and, if it's possible, a swagger GUI interface to test it.
I have read several official/unofficial docs and I find interesting docs here another much interesting example here.
My preoccupation is that many of this articles are dated before 2020 (for example one of these use deprecated annotation likes @EnableSwagger2Mvc
) but I can't managed to find out something more updated.
Is anyone aware of a more up-to-date procedure?
-------------------------- UPDATE --------------------------
First of all Thanks @ArtemBilan for yor response.
Yes I read that article and I'm not new to documenting my REST API
. With springdoc-openapi-ui
I'm able to create a .json
file that, if putted in some editor like http://swagger.io
or if used with a specific maven plugin can create a client (in both spring java
and Angular
language) ready for use.
I have tried the springfox way (above) to documenting my spring-integration-http
but it sucks! It generate some useless files to reproduce the call via CURL..
Is not what I'm looking for. I must (the STO asks) documenting my endpoint like the .yaml
you can find for the example Swagger Pet Store.
And it seems there's no way with this spring-integration-http
to do so..
Any help is appreciate.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论