openapi-generator/modules/openapi-generator-online
Philzen ed2aad6756
[JAVA: okhttp-gson, rest-assured, retrofit2] Don't generate Jackson import when serialization library is GSON (#18811)
* Partially revert "replace deprecated ISO8601Utils with StdDateFormat (#17052)"

This partially reverts commit 76560e34c9aacd9d7593ac45bd204e2edf38abd9, namely anything
related to generators and samples using GSON instead of Jackson.

Changes to Jackson-only generation and generator-online regarding RFC3339DateFormat
are not being reverted.

* Test for default serialization library fallback

* Convert repetitive tests to parameterized test

* Add regression test for #18515

* [FEIGN] Only include <jackson-databind-version> property in pom.xml when required

* [RETROFIT2] Only include jackson-databind in gradle file when actually required

* [FEIGN] Don't include jackson dep's in sbt file when GSON is selected

* [FEIGN] Don't include jackson dep's in gradle file when GSON is selected

* DRY refactor JavaClientCodegen test code, increase readability

- use fluent assertions
- use helper method newTempFolder()
- use Java 9 static factory methods for maps
- don't declare variables that are only used once
- group declarations and usages
- use non-blocking java.nio.file API wherever possible

* Regenerate samples
2024-06-02 21:42:55 +08:00
..
2024-04-17 19:05:37 +08:00

OpenAPI generated server

A Spring Boot Server application which hosts a client/server generator API.

Overview

This server was generated by the OpenAPI Generator project. By using the OpenAPI-Spec, you can easily generate a server stub or one of 100+ client packages.

This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework.

The underlying library integrating OpenAPI to SpringBoot is springfox

Building

Refer to root README for build directions.

Running

Via command line

Running is as simple as:

java -jar ./target/openapi-generator-online.jar

This exposes the API on local port 8080.

Springfox supports configuration of the "host" value in the output OpenAPI document by setting the Host HTTP header in the request. To set this explicitly, pass the system property springfox.documentation.swagger.v2.host with the desired host. For example:

java -Dspringfox.documentation.swagger.v2.host=example.com:8888 -jar ./target/openapi-generator-online.jar

Via Docker

After building from source, change to this module directory (cd modules/openapi-generator-online) and build the docker image:

docker build -t openapitools/openapi-generator-online:latest .

Now, run the docker image:

docker run -d -p 8888:8080 openapitools/openapi-generator-online

The GENERATOR_HOST variable is used here to ensure download links generated by the API refer to the proper API location.

Environment

GENERATOR_HOST can be set to force the scheme/host/port used for download link generation. In most cases, this environment variable is not necessary to be set and the download link will be generated to match the originating request. The variable is provided simply as a fallback.