Created
September 16, 2022 18:59
-
-
Save tslmy/ad85e44047af1f1b995db1aed7f2ded1 to your computer and use it in GitHub Desktop.
Generate code from OpenAPI contracts: Gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'org.hidetake.swagger.generator' version '2.19.2' | |
} | |
dependencies { | |
// https://github.com/int128/gradle-swagger-generator-plugin#code-generation | |
swaggerCodegen 'io.swagger.codegen.v3:swagger-codegen-cli:3.0.35' | |
} | |
swaggerSources { | |
// We name this API "petstore". | |
petstore { | |
inputFile = file('openapi-contract.yaml') | |
code { | |
language = 'java' | |
configFile = file('swagger-config.json') | |
outputDir = file('build/gen-src') | |
components = [ | |
// Whether each of the following should be generated. | |
apis: false, | |
apiTests: false, | |
models: true, | |
modelTests: false, | |
] | |
additionalProperties = [ | |
'includeSwaggerAnnotations': false, | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment