在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Yelp/swagger-gradle-codegen开源软件地址(OpenSource Url):https://github.com/Yelp/swagger-gradle-codegen开源编程语言(OpenSource Language):Kotlin 84.4%开源软件介绍(OpenSource Introduction):Swagger Gradle CodegenA Gradle plugin to generate networking code from a Swagger spec file. This plugin wraps swagger-codegen, and exposes a configurable Getting StartedSwagger Gradle Codegen is distributed through Gradle Plugin Portal. To use it you need to add the following dependency to your gradle files. Please note that those code needs to be added the gradle file of the module where you want to generate the code (not the top level build.gradle[.kts] file). If you're using the Groovy Gradle files: buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "com.yelp.codegen:plugin:<latest_version>"
}
}
apply plugin: "com.yelp.codegen.plugin"
generateSwagger {
platform = "kotlin"
packageName = "com.yelp.codegen.samples"
inputFile = file("./sample_specs.json")
outputDir = file("./src/main/java/")
} If you're using the Kotlin Gradle files: plugins {
id("com.yelp.codegen.plugin") version "<latest_version>"
}
generateSwagger {
platform.set("kotlin")
packageName.set("com.yelp.codegen.samples")
inputFile.set(file("./sample_specs.json"))
outputDir.set(project.layout.buildDirectory.dir("./src/main/java/"))
} Please note that the Once you setup the plugin correctly, you can call the RequirementsIn order to run this gradle plugin you need to fulfill the following requirements:
Supported platformsThe Swagger Gradle Codegen is designed to support multiple platforms. For every platform, we provide templates that are tested and generates opinionated code. Here the list of the supported platforms:
We're looking forward to more platforms to support in the future. Contributions are more than welcome. ExamplesYou can find some examples in this repository to help you set up your generator environment.
How the generated code will look likeHere you can find some examples of how the generated code will look like in your project. ConfigurationTo configure the generator, please use the generateSwagger {
platform.set("kotlin")
packageName.set("com.yelp.codegen.integrations")
specName.set("integration")
specVersion.set("1.0.0")
inputFile.set(file("../sample_specs.json"))
outputDir.set(project.layout.buildDirectory.dir("./src/main/java/"))
features {
headersToRemove.add("Accept-Language")
}
} And here a table with all the properties and their default values:
Please note that all those properties can be configured with command line flags that mirrors 1:1 the property name. E.g.: ./gradlew generateSwagger --inputFile=./sample/specs.json Extra FeaturesYou can use the Here a list of all the supported features:
BuildingTo contribute or to start developing the Swagger Codegen Plugin, you need to set up your environment. Make sure you have:
We also recommend you set up:
Before starting developing, please run:
This will take care of installing the pre-commit hooks to keep a consistent style in the codebase. While developing, you can build, run pre-commits, checks & tests on the plugin using:
Make sure your tests are all green NOTE: If you don't have the Android SDK you can skip the Android related tasks by setting Contributing/SupportSupport for this project is offered in the #swagger-gradle-codegen channel on the Kotlinlang slack (request an invite here). We're looking for contributors! Feel free to open issues/pull requests to help me improve this project. If you found a new issue related to incompatible Swagger specs, please attach also the spec file to help investigate the issue. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论