Stefan Koppier 9358ab9d1d
[kotlin] New 'jvm-spring-webclient' library (#15568)
* Added library 'jvm-spring-webclient' to Kotlin client generator

* Reran all generators and generated docs

* Changed target of kotlin-jvm-spring-webclient sample from 2_0 to 3_0

* Added build of kotlin-jvm-spring-webclient to github workflow
2023-05-23 11:34:52 +08:00

2.0 KiB

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