Skip to content

Commit

Permalink
Merge branch 'OpenAPITools:master' into microprofile-server-generator
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarobr authored May 6, 2024
2 parents 1fa87ec + cefbf62 commit f9ce785
Show file tree
Hide file tree
Showing 2,060 changed files with 107,010 additions and 17,651 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ commands: # a reusable command with parameters
jobs:
node0:
machine:
image: ubuntu-2004:202201-02
image: ubuntu-2004:2024.01.1
working_directory: ~/OpenAPITools/openapi-generator
shell: /bin/bash --login
environment:
Expand All @@ -154,7 +154,7 @@ jobs:
nodeNo: "0"
node1:
machine:
image: ubuntu-2004:202201-02
image: ubuntu-2004:2024.01.1
working_directory: ~/OpenAPITools/openapi-generator
shell: /bin/bash --login
environment:
Expand All @@ -167,7 +167,7 @@ jobs:
nodeNo: "1"
node2:
machine:
image: ubuntu-2004:202201-02
image: ubuntu-2004:2024.01.1
working_directory: ~/OpenAPITools/openapi-generator
shell: /bin/bash --login
environment:
Expand All @@ -180,7 +180,7 @@ jobs:
nodeNo: "2"
node3:
machine:
image: ubuntu-2004:202201-02
image: ubuntu-2004:2024.01.1
working_directory: ~/OpenAPITools/openapi-generator
shell: /bin/bash --login
environment:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- 'samples/client/petstore/java/**'
- 'samples/openapi3/client/petstore/java/**'
env:
GRADLE_VERSION: 7.2
GRADLE_VERSION: 8.7

jobs:
build:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/samples-go.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
name: Samples Go
name: Samples Go

on:
push:
paths:
- 'samples/server/petstore/go-echo-server/**'
- 'samples/server/petstore/go-api-server/**'
- 'samples/server/petstore/go-chi-server/**'
- 'samples/server/others/go-server/no-body-path-params/**'
pull_request:
paths:
- 'samples/server/petstore/go-echo-server/**'
- 'samples/server/petstore/go-api-server/**'
- 'samples/server/petstore/go-chi-server/**'
- 'samples/server/others/go-server/no-body-path-params/**'

jobs:
build:
name: Build Go
name: Build Go
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -23,6 +25,7 @@ jobs:
- samples/server/petstore/go-echo-server/
- samples/server/petstore/go-api-server/
- samples/server/petstore/go-chi-server/
- samples/server/others/go-server/no-body-path-params/
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/samples-java-client-echo-api-jdk17.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Java Client (Echo API) JDK17

on:
push:
paths:
- samples/client/echo_api/java/restclient
pull_request:
paths:
- samples/client/echo_api/java/restclient
jobs:
build:
name: Build Java Client JDK17
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# clients
- samples/client/echo_api/java/restclient
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Cache maven dependencies
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
path: |
~/.m2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Setup node.js
uses: actions/setup-node@v4
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
(cd http-echo-server && npm install && npm start &)
- name: Build
working-directory: ${{ matrix.sample }}
run: mvn clean package
27 changes: 25 additions & 2 deletions .github/workflows/samples-java-client-jdk17.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ on:
paths:
- samples/client/petstore/java/resttemplate-jakarta/**
- samples/client/petstore/java/webclient-jakarta/**
- samples/client/petstore/java/restclient-*/**
pull_request:
paths:
- samples/client/petstore/java/resttemplate-jakarta/**
- samples/client/petstore/java/webclient-jakarta/**
- samples/client/petstore/java/restclient-*/**
jobs:
build:
name: Build Java Client JDK17
Expand All @@ -20,6 +22,9 @@ jobs:
# clients
- samples/client/petstore/java/resttemplate-jakarta
- samples/client/petstore/java/webclient-jakarta
- samples/client/petstore/java/restclient
- samples/client/petstore/java/restclient-nullable-arrays
- samples/client/petstore/java/restclient-swagger2
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
Expand All @@ -34,9 +39,27 @@ jobs:
path: |
~/.m2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}

- name: Build with Maven
working-directory: ${{ matrix.sample }}
run: mvn clean package
- name: Build with Gradle

- name: Cache gradle dependencies
uses: actions/cache@v4
env:
cache-name: gradle-caches
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}

- name: Cache gradle wrapper
uses: actions/cache@v4
env:
cache-name: gradle-wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}

- name: Build
working-directory: ${{ matrix.sample }}
run: gradle clean build
run: ./gradlew build -x test
7 changes: 1 addition & 6 deletions .github/workflows/samples-kotlin-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ on:
- 'samples/client/petstore/kotlin*/**'
- 'samples/client/others/kotlin-jvm-okhttp-parameter-tests/**'

env:
GRADLE_VERSION: 6.9

jobs:
build:
name: Build Kotlin client
Expand Down Expand Up @@ -65,15 +62,14 @@ jobs:
- samples/client/echo_api/kotlin-jvm-spring-3-webclient
- samples/client/petstore/kotlin-jvm-spring-3-restclient
- samples/client/echo_api/kotlin-jvm-spring-3-restclient
- samples/client/petstore/kotlin-spring-cloud
- samples/client/petstore/kotlin-name-parameter-mappings
- samples/client/others/kotlin-jvm-okhttp-parameter-tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 8
java-version: 11
- name: Cache maven dependencies
uses: actions/cache@v4
env:
Expand All @@ -85,7 +81,6 @@ jobs:
- name: Install Gradle wrapper
uses: eskatos/gradle-command-action@v3
with:
gradle-version: ${{ env.GRADLE_VERSION }}
build-root-directory: ${{ matrix.sample }}
arguments: wrapper
- name: Build
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/samples-kotlin-echo-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ on:
pull_request:
paths:
- samples/client/echo_api/kotlin**
env:
GRADLE_VERSION: 7.4

jobs:
build:
name: Build Kotlin Client JDK17
Expand Down Expand Up @@ -37,7 +36,6 @@ jobs:
- name: Install Gradle wrapper
uses: eskatos/gradle-command-action@v3
with:
gradle-version: ${{ env.GRADLE_VERSION }}
build-root-directory: ${{ matrix.sample }}
arguments: wrapper
- name: Setup node.js
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/samples-kotlin-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
- samples/server/petstore/kotlin-server/javalin
- samples/server/others/kotlin-server/jaxrs-spec
- samples/server/others/kotlin-server/jaxrs-spec-array-response
- samples/server/petstore/kotlin-spring-cloud
# comment out due to gradle build failure
#- samples/server/petstore/kotlin-spring-default
# no build.gradle file
Expand Down
2 changes: 2 additions & 0 deletions .sdkmanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
java=11.0.23-tem
maven=3.8.8
1 change: 1 addition & 0 deletions CI/circle_parallel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,6 @@ else
(cd samples/client/petstore/java/resteasy && mvn integration-test)
(cd samples/client/petstore/java-micronaut-client && mvn integration-test)
(cd samples/client/petstore/java/apache-httpclient && mvn integration-test)
(cd samples/client/petstore/java/resttemplate-jakarta && mvn integration-test)

fi
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ To build from source, you need the following installed and available in your `$P

* [Java 11](https://adoptium.net/)

* [Apache Maven 3.3.4 or greater](https://maven.apache.org/) (optional)
* [Apache Maven 3.8.8 or greater](https://maven.apache.org/) (optional)

After cloning the project, you can build it from source using [maven wrapper](https://maven.apache.org/wrapper/):

Expand Down
7 changes: 7 additions & 0 deletions bin/configs/cpp-pistache-server-cpp-pistache-everything.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
generatorName: cpp-pistache-server
outputDir: samples/server/petstore/cpp-pistache-everything
inputSpec: modules/openapi-generator/src/test/resources/3_0/issues-anytype-object-set-petstore-everything.yaml
templateDir: modules/openapi-generator/src/main/resources/cpp-pistache-server
additionalProperties:
useStructModel: "false"
addExternalLibs: "true"
8 changes: 8 additions & 0 deletions bin/configs/go-server-no-body-path-params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
generatorName: go-server
outputDir: samples/server/others/go-server/no-body-path-params
inputSpec: modules/openapi-generator/src/test/resources/3_0/go-server/no-body-path-params.yaml
templateDir: modules/openapi-generator/src/main/resources/go-server
additionalProperties:
hideGenerationTimestamp: "true"
packageName: petstoreserver
addResponseHeaders: true
4 changes: 1 addition & 3 deletions bin/configs/java-jersey2-special-characters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ additionalProperties:
dateLibrary: java8
useOneOfDiscriminatorLookup: true
disallowAdditionalPropertiesIfNotPresent: false
systemProperties:
skipValidateSpec: "false"

validateSpec: false
13 changes: 13 additions & 0 deletions bin/configs/java-restclient-echo-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
generatorName: java
outputDir: samples/client/echo_api/java/restclient
library: restclient
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: echo-api-native
hideGenerationTimestamp: "true"

typeMappings:
OffsetDateTime: "Instant"
importMappings:
OffsetDateTime: "java.time.Instant"
8 changes: 8 additions & 0 deletions bin/configs/java-restclient-nullable-array.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
generatorName: java
outputDir: samples/client/petstore/java/restclient-nullable-arrays
library: restclient
inputSpec: modules/openapi-generator/src/test/resources/3_0/schema-with-nullable-arrays.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-restclient-nullable-arrays
hideGenerationTimestamp: "true"
10 changes: 10 additions & 0 deletions bin/configs/java-restclient-swagger2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
generatorName: java
outputDir: samples/client/petstore/java/restclient-swagger2
library: restclient
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-restclient
hideGenerationTimestamp: "true"
containerDefaultToNull: "true"
annotationLibrary: "swagger2"
9 changes: 9 additions & 0 deletions bin/configs/java-restclient-useAbstractionForFiles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
generatorName: java
outputDir: samples/client/others/java/restclient-useAbstractionForFiles
library: restclient
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue13146_file_abstraction_response.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: file-restclient
hideGenerationTimestamp: "true"
useAbstractionForFiles: true
9 changes: 9 additions & 0 deletions bin/configs/java-restclient.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
generatorName: java
outputDir: samples/client/petstore/java/restclient
library: restclient
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-restclient
hideGenerationTimestamp: "true"
containerDefaultToNull: "true"
1 change: 1 addition & 0 deletions bin/configs/java-resttemplate-jakarta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ additionalProperties:
hideGenerationTimestamp: "true"
java8: true
useJakartaEe: true
generateConstructorWithAllArgs: true
1 change: 1 addition & 0 deletions bin/configs/java-resttemplate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ additionalProperties:
hideGenerationTimestamp: "true"
java8: true
containerDefaultToNull: true
generateConstructorWithAllArgs: true
2 changes: 1 addition & 1 deletion bin/configs/kotlin-jvm-spring-3-webclient-echo-api.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
generatorName: kotlin
outputDir: samples/client/echo_api/kotlin-jvm-spring-3-webclient
library: jvm-spring-restclient
library: jvm-spring-webclient
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/echo_api.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
additionalProperties:
Expand Down
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-cloud.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
generatorName: kotlin-spring
outputDir: samples/client/petstore/kotlin-spring-cloud
outputDir: samples/server/petstore/kotlin-spring-cloud
library: spring-cloud
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
Expand Down
1 change: 1 addition & 0 deletions bin/configs/spring-boot-3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ additionalProperties:
useBeanValidation: true
withXml: true
hideGenerationTimestamp: "true"
generateConstructorWithAllArgs: true
1 change: 1 addition & 0 deletions bin/configs/spring-boot-delegate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ additionalProperties:
hideGenerationTimestamp: "true"
java8: true
delegatePattern: "true"
generateConstructorWithAllArgs: true
1 change: 1 addition & 0 deletions bin/configs/spring-boot-lombok-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ additionalProperties:
artifactId: springboot-lombok-data
hideGenerationTimestamp: "true"
additionalModelTypeAnnotations: "@lombok.Data;@lombok.Builder;@lombok.NoArgsConstructor;@lombok.AllArgsConstructor"
generateConstructorWithAllArgs: true
1 change: 0 additions & 1 deletion docs/generators/cpp-pistache-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl

| Type/Alias | Imports |
| ---------- | ------- |
|Object|#include "Object.h"|
|nlohmann::json|#include <nlohmann/json.hpp>|
|std::map|#include <map>|
|std::string|#include <string>|
Expand Down
1 change: 1 addition & 0 deletions docs/generators/groovy.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
|groupId|groupId in generated pom.xml| |org.openapitools|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false|
Expand Down
1 change: 1 addition & 0 deletions docs/generators/java-camel.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|documentationProvider|Select the OpenAPI documentation provider.|<dl><dt>**none**</dt><dd>Do not publish an OpenAPI specification.</dd><dt>**source**</dt><dd>Publish the original input OpenAPI specification.</dd><dt>**springfox**</dt><dd>Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.</dd><dt>**springdoc**</dt><dd>Generate an OpenAPI 3 specification using SpringDoc.</dd></dl>|springdoc|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
|generatedConstructorWithRequiredArgs|Whether to generate constructors with required args for models| |true|
|groupId|groupId in generated pom.xml| |org.openapitools|
|hateoas|Use Spring HATEOAS library to allow adding HATEOAS links| |false|
Expand Down
Loading

0 comments on commit f9ce785

Please sign in to comment.