• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

springdoc/springdoc-openapi-maven-plugin: Library for OpenAPI 3 with spring-boot

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

springdoc/springdoc-openapi-maven-plugin

开源软件地址(OpenSource Url):

https://github.com/springdoc/springdoc-openapi-maven-plugin

开源编程语言(OpenSource Language):

Java 100.0%

开源软件介绍(OpenSource Introduction):

Build Status Quality Gate

Introduction to springdoc-openapi-maven-plugin

The aim of springdoc-openapi-maven-plugin is to generate json and yaml OpenAPI description during runtime. If you want to get swagger definitions properly, the application should completely running as locally. The plugin works during integration-tests phase, and generate the OpenAPI description. The plugin works in conjunction with spring-boot-maven plugin.

You can test it during the integration tests phase using the maven command:

mvn verify

In order to use this functionality, you need to add the plugin declaration on the plugins section of your pom.xml:

<plugins>
  <plugin>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-maven-plugin</artifactId>
   <version>2.3.4.RELEASE</version>
   <configuration>
      <jvmArguments>-Dspring.application.admin.enabled=true</jvmArguments>
   </configuration>
   <executions>
    <execution>
     <id>pre-integration-test</id>
     <goals>
      <goal>start</goal>
     </goals>
    </execution>
    <execution>
     <id>post-integration-test</id>
     <goals>
      <goal>stop</goal>
     </goals>
    </execution>
   </executions>
  </plugin>
  <plugin>
   <groupId>org.springdoc</groupId>
   <artifactId>springdoc-openapi-maven-plugin</artifactId>
   <version>1.1</version>
   <executions>
    <execution>
     <id>integration-test</id>
     <goals>
      <goal>generate</goal>
     </goals>
    </execution>
   </executions>
  </plugin>
</plugins>

Custom settings of the springdoc-openapi-maven-plugin

It possible to customise the following plugin properties:

  • attachArtifact: install / deploy the api doc to the repository
    • The default value is: false
  • apiDocsUrl: The local url of your (json or yaml).
  • outputDir: The output directory, where to generate the OpenAPI description.
    • The default value is: ${project.build.directory}
  • outputFileName: The file name that contains the OpenAPI description.
    • The default value is: openapi.json
  • skip: Skip execution if set to true.
    • The default value is: false
  • headers: List of headers to send in request
    • The default value is empty
<plugin>
 <groupId>org.springdoc</groupId>
 <artifactId>springdoc-openapi-maven-plugin</artifactId>
 <version>1.1</version>
 <executions>
  <execution>
   <id>integration-test</id>
   <goals>
    <goal>generate</goal>
   </goals>
  </execution>
 </executions>
 <configuration>
  <apiDocsUrl>http://localhost:8080/v3/api-docs</apiDocsUrl>
  <outputFileName>openapi.json</outputFileName>
  <outputDir>/home/springdoc/maven-output</outputDir>
  <skip>false</skip>
  <headers>
    <header1key>header1value</header1key>
    <header2key>header2value</header2key>
  </headers>
 </configuration>
</plugin>

Thank you for the support

  • Thanks a lot JetBrains for supporting springdoc-openapi project.

JenBrains logo




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap