PR checklist
-
Read the contribution guidelines. -
Ran the shell script under ./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
. -
Filed the PR against the correct branch: Default: master
. -
Copied the technical committee to review the pull request if your PR is targeting a particular programming language.
Description of the PR
See #141 (closed)
This is an initial implementation of a gradle-plugin for OpenAPI Generator. I've opened this PR to solicit feedback. Please see the initial commit of README.adoc for details and examples.
To test this out, you'll first need to build the generator:
mvn clean package install
Then, you'll want to build and publish the gradle plugin locally (update inputSpec
references to your own locally available specs):
cd gradle
./gradlew build
./gradlew publishToMavenLocal
From here, you can create a simple build.gradle
and execute tasks:
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.openapitools:openapi-generator-gradle-plugin:3.0.0-SNAPSHOT"
}
}
apply plugin: 'org.openapi.generator'
openApiMeta {
generatorName = "Jim"
packageName = "us.jimschubert.example"
}
openApiValidate {
inputSpec = "/Users/jim/projects/openapi-generator/modules/openapi-generator/src/test/resources/3_0/petstore.yaml"
}
openApiGenerate {
generatorName = "kotlin"
inputSpec = "$rootDir/specs/petstore-v3.0.yaml".toString()
outputDir = "$buildDir/generated".toString()
apiPackage = "org.openapi.example.api"
invokerPackage = "org.openapi.example.invoker"
modelPackage = "org.openapi.example.model"
modelFilesConstrainedTo = [
"Error"
]
configOptions = [
dateLibrary: "java8"
]
}
Details around how to configure this to build and published via CI will be worked out after getting feedback on the plugin.