I have the following configuration in my build.gradle file
plugins {
id 'java'
id 'org.openapi.generator' version '4.1.3'
}
repositories {
maven { url "https://mavenrepo.schwab.com/nexus/content/groups/public" }
maven { url "https://mavenrepo.schwab.com/nexus/content/repositories/releases/" }
mavenCentral()
jcenter()
}
sourceSets.main.java.srcDirs += "$buildDir/generated/src/main/java"
openApiGenerate {
generatorName = "java"
inputSpec = "$rootDir/API/POMOrchestrator.v1.json".toString()
outputDir = "$rootDir/application/".toString()
apiPackage = "com.schwab.brokerage.party.onborading.api.inbound.rest.controller"
invokerPackage = "com.schwab.brokerage.party.onborading"
modelPackage = "com.schwab.brokerage.party.onborading.models.swagger"
modelNamePrefix = "Party"
configOptions = [
dateLibrary: "java8-localdatetime"
]
}
compileJava.dependsOn tasks.openApiGenerate
When I execute the following command
gradle openApiGenerators --warning-mode all
I get the following output with no error (apparent error as I assume it doesn't like my generator name), no outputed classes.
> Configure project :
Using method ObjectFactory.property() method to create a property of type Map<K, V> has been deprecated. This will fail with an error in Gradle 6.0. Please use the Ob
jectFactory.mapProperty() method instead.
> Task :openApiGenerators
The following generators are available:
CLIENT generators:
- ada
- android
- apex
- bash
- c
- clojure
- cpp-qt5-client
- cpp-restsdk
- cpp-tizen
- csharp
- csharp-netcore
- dart
- dart-jaguar
- eiffel
- elixir
- elm
- erlang-client
- erlang-proper
- flash
- go
- go-experimental (experimental)
- groovy
- haskell-http-client
- java
- javascript
- javascript-closure-angular
- javascript-flowtyped
- jaxrs-cxf-client
- jmeter
- kotlin
- lua
- nim (beta)
- objc
- ocaml
- perl
- php
- powershell
- python
- python-experimental (experimental)
- r
- ruby
- rust
- scala-akka
- scala-gatling
- scalaz
- swift4
- typescript-angular
- typescript-angularjs
- typescript-aurelia
- typescript-axios
- typescript-fetch
- typescript-inversify
- typescript-jquery
- typescript-node
- typescript-rxjs
SERVER generators:
- ada-server
- aspnetcore
- cpp-pistache-server
- cpp-qt5-qhttpengine-server
- cpp-restbed-server
- csharp-nancyfx
- erlang-server
- fsharp-functions (beta)
- fsharp-giraffe-server (beta)
- go-gin-server
- go-server
- graphql-nodejs-express-server
- haskell
- java-inflector
- java-msf4j
- java-pkmst
- java-play-framework
- java-undertow-server
- java-vertx
- jaxrs-cxf
- jaxrs-cxf-cdi
- jaxrs-cxf-extended
- jaxrs-jersey
- jaxrs-resteasy
- jaxrs-resteasy-eap
- jaxrs-spec
- kotlin-server
- kotlin-spring
- kotlin-vertx (beta)
- nodejs-express-server (beta)
- php-laravel
- php-lumen
- php-silex
- php-slim
- php-symfony
- php-ze-ph
- python-aiohttp
- python-blueplanet
- python-flask
- ruby-on-rails
- ruby-sinatra
- rust-server
- scala-finch
- scala-lagom-server
- scala-play-server
- scalatra
- spring
DOCUMENTATION generators:
- asciidoc
- cwiki
- dynamic-html
- html
- html2
- openapi
- openapi-yaml
SCHEMA generators:
- avro-schema (beta)
- mysql-schema
CONFIG generators:
- apache2
- graphql-schema
- protobuf-schema (beta)
OTHER generators:
BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
First time trying this and not sure what is wrong.
Ultimately I want to get this working and then specify templates so that I can add lombok annotations (as asked in this question Gradle Swagger CodeGen DefaultGenerator CodegenConfigurator Add Lombok but not answered yet). However, I have to get the code gen working first.
I was calling the wrong method. The openApiGenerators just list the generators which is what it was doing. To generate the output, you have to call the task created above openApiGenerate. Thanks @philonous for the answer.