在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):springdoc/springdoc-openapi-gradle-plugin开源软件地址(OpenSource Url):https://github.com/springdoc/springdoc-openapi-gradle-plugin开源编程语言(OpenSource Language):Kotlin 85.5%开源软件介绍(OpenSource Introduction):Introducing springdoc-openapi-gradle-pluginGradle plugin for springdoc-openapi. This plugin allows you to generate an OpenAPI 3 specification for a Spring Boot application from a Gradle build. Compatibility NotesThe plugin is built on Gradle version 7.0. DependenciesThis plugin has a runtime dependency on the following plugins:
How To UseGradle Groovy DSL plugins {
id "org.springframework.boot" version "2.3.0.RELEASE"
id "org.springdoc.openapi-gradle-plugin" version "1.3.4"
} Gradle Kotlin DSL plugins {
id("org.springframework.boot") version "2.3.0.RELEASE"
id("org.springdoc.openapi-gradle-plugin") version "1.3.4"
} Note: For latest versions of the plugins please check the Gradle Plugins portal. How the plugin works?When you add this plugin and its runtime dependency plugins to your build file, the plugin creates the following tasks:
Running the task gradle clean generateOpenApiDocs When you run the gradle task generateOpenApiDocs, it starts your spring boot application in the background using forkedSpringBootRun task. Once your application is up and running generateOpenApiDocs makes a rest call to your applications doc url to download and store the open api docs file as json. CustomizationThe following customizations can be done on task generateOpenApiDocs using extension openApi as follows openApi {
apiDocsUrl.set("https://localhost:9000/api/docs")
outputDir.set(file("$buildDir/docs"))
outputFileName.set("swagger.json")
waitTimeInSeconds.set(10)
forkProperties.set("-Dspring.profiles.active=special")
groupedApiMappings.set(["https://localhost:8080/v3/api-docs/groupA" to "swagger-groupA.json",
"https://localhost:8080/v3/api-docs/groupB" to "swagger-groupB.json"])
}
Fork properties examplesFork properties allows you to send in anything that might be necessary to allow for the forked spring boot application that gets started to be able to start (profiles, other custom properties, etc etc) Static string
Passing straight from gradleThis allows for you to be able to just send in whatever you need when you generate docs.
and as long as the config looks as follows that value will be passed into the forked spring boot application.
Grouped API Mappings NotesThe Building the plugin
Testing the plugin
Thank you for the support
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论