问题描述
我有提供openapi的spring boot应用程序。我用过Swagger。我有一个存储jsonSchema的文件,我想将其解析为io.swagger.v3.oas.models.media.Schema并将其添加到Swagger中。我找不到任何现有的解决方案。春季启动库是否支持此功能? 谢谢。
解决方法
如果您使用的是Spring Web MVC HATEOS端点,则可以直接使用https://springdoc.org/。例如:@ RequestMapping,@ GetMapping等。
Springdoc-openapi随附ui和open api v3文档生成。
如果没有,那么您更喜欢使用JaxRS2配置RESTful端点,然后使用<groupId>io.swagger.core.v3</groupId><artifactId>swagger-jaxrs2</artifactId>
,并使用JerseyConfig extends ResourceConfig and include io.swagger.v3.integration.sources
注册资源以进行jaxrs2扫描。