Jim Schubert 23131c1a63
Use HTTPS Maven URL in Kotlin meta generator (#5043)
This continues on work in #5033 and #5034 which convert all http usage
to https to unblock CircleCI builds.

In #5034, mavenCentral() DSL was updated to explicitly target the https
maven repo because Gradle didn't force TLS 1.2 until v4.8.1 and many of
our examples use earlier versions of Gradle.  The Kotlin meta generator
was missed because it is a .kts build file rather than build.gradle, and
the mustache filename doesn't have kts in it; the file was updated as if
it was build.gradle (groovy syntax).
2020-01-19 10:42:25 -05:00
..

my-client-codegen-openapi-generator

Requirements

  • Gradle 5.x
  • Java 8+

Getting Started

  • Initialize the gradle wrapper:
    gradle wrapper --gradle-version 5.6.2
    
  • Modify the codegen class and associated templates
  • Compile with ./gradlew standalone
  • Verify:
    java -jar build/libs/my-client-codegen-openapi-generator-standalone.jar config-help -g myClientCodegen
    

Building

Standalone

As seen in "Getting Started", the generator may be built as a standalone customized version of OpenAPI Generator's CLI. This may be the simplest option for developers who are unfamiliar with working in the JVM. Please be aware of any licensing concerns before distributing this "uber-jar".

To build as a standalone, run:

./gradlew standalone

To list generators via OpenAPI Generator CLI:

java -jar build/libs/my-client-codegen-openapi-generator-standalone.jar list --include all

ShadowJar

This generator supports building as a lightweight "fat-jar". This option includes Kotlin or any other implementation dependencies you'll add. This will simplify publishing if your generator has many dependencies.

To build as a shadowJar, run:

./gradlew shadowJar

To list generators via OpenAPI Generator CLI, you must refer to the CLI jar explicitly. We add a custom copy task which includes the CLI jar in the build output directory:

java -cp build/libs/openapi-generator-cli-4.1.3.jar:build/libs/my-client-codegen-openapi-generator-1.0-SNAPSHOT-all.jar org.openapitools.codegen.OpenAPIGenerator list

Notice that this command must pass classpath via -cp and include OpenAPI Generator CLI as well as the artifact built from this project. Also notice that the manifest class must be passed explicitly as org.openapitools.codegen.OpenAPIGenerator.

See Also