Skip to content

Commit

Permalink
Merge branch 'master' into fix_17831
Browse files Browse the repository at this point in the history
  • Loading branch information
dabdirb committed Feb 23, 2024
2 parents 3161168 + 9f5ec17 commit f05dd3c
Show file tree
Hide file tree
Showing 1,084 changed files with 31,156 additions and 11,400 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/samples-go-gin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Samples Go

on:
push:
paths:
- 'samples/server/petstore/go-gin-api-server/**'
- 'samples/server/petstore/go-gin-api-server-interface-only/**'
pull_request:
paths:
- 'samples/server/petstore/go-gin-api-server/**'
- 'samples/server/petstore/go-gin-api-server-interface-only/**'

jobs:
build:
name: Build Go
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
- samples/server/petstore/go-gin-api-server/
- samples/server/petstore/go-gin-api-server-interface-only/
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "stable"
- run: go version
- name: Run test
working-directory: ${{ matrix.sample }}
run: go test -mod=mod -v
3 changes: 0 additions & 3 deletions .github/workflows/samples-kotlin-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jobs:
- samples/client/petstore/kotlin-multiplatform-kotlinx-datetime
- samples/client/petstore/kotlin-nonpublic
- samples/client/petstore/kotlin-nullable
- samples/client/petstore/kotlin-okhttp3
- samples/client/petstore/kotlin-retrofit2
- samples/client/petstore/kotlin-retrofit2-kotlinx_serialization
- samples/client/petstore/kotlin-retrofit2-jackson
Expand All @@ -43,12 +42,10 @@ jobs:
- samples/client/petstore/kotlin-threetenbp
- samples/client/petstore/kotlin-kotlinx-datetime
- samples/client/petstore/kotlin-uppercase-enum
- samples/client/petstore/kotlin-default-values-jvm-okhttp3
- samples/client/petstore/kotlin-default-values-jvm-okhttp4
- samples/client/petstore/kotlin-default-values-jvm-retrofit2
- samples/client/petstore/kotlin-default-values-jvm-volley
- samples/client/petstore/kotlin-default-values-multiplatform
- samples/client/petstore/kotlin-array-simple-string-jvm-okhttp3
- samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4
- samples/client/petstore/kotlin-array-simple-string-jvm-volley
- samples/client/petstore/kotlin-array-simple-string-multiplatform
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/samples-kotlin-echo-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Kotlin Client (Echo API) JDK17

on:
push:
paths:
- samples/client/echo_api/kotlin**
pull_request:
paths:
- samples/client/echo_api/kotlin**
env:
GRADLE_VERSION: 7.4
jobs:
build:
name: Build Kotlin Client JDK17
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# clients
- samples/client/echo_api/kotlin-jvm-spring-3-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: |
~/.gradle
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- 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
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: ./gradlew build
33 changes: 33 additions & 0 deletions .github/workflows/samples-python-fastapi-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Python FastAPI Server

on:
push:
paths:
- samples/server/petstore/python-fastapi/**
pull_request:
paths:
- samples/server/petstore/python-fastapi/**
jobs:
build:
name: Test Python FastAPI server
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# servers
- samples/server/petstore/python-fastapi/
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
working-directory: ${{ matrix.sample }}
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
- name: Test
working-directory: ${{ matrix.sample }}
run: PYTHONPATH=src pytest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ samples/server/petstore/kotlin-springboot/build
samples/client/petstore/kotlin*/src/main/kotlin/test/
samples/client/petstore/kotlin*/build/
samples/server/others/kotlin-server/jaxrs-spec/build/
samples/client/echo_api/kotlin-jvm-spring-3-restclient/build/

# haskell
.stack-work
Expand Down
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<extension>
<groupId>com.gradle</groupId>
<artifactId>gradle-enterprise-maven-extension</artifactId>
<version>1.20</version>
<version>1.20.1</version>
</extension>
<extension>
<groupId>com.gradle</groupId>
Expand Down
14 changes: 3 additions & 11 deletions .mvn/gradle-enterprise.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,12 @@
</buildScan>
<buildCache>
<local>
<enabled>false</enabled>
<enabled>true</enabled>
</local>
<remote>
<server>
<url>https://ge.openapi-generator.tech/cache/exp3/</url> <!-- adjust to your GE hostname, and note the trailing slash -->
<allowUntrusted>true</allowUntrusted> <!-- set to false if a trusted certificate is configured for the GE server -->
<credentials>
<username>${env.GRADLE_ENTERPRISE_CACHE_USERNAME}</username>
<password>${env.GRADLE_ENTERPRISE_CACHE_PASSWORD}</password>
</credentials>
</server>
<enabled>true</enabled> <!-- must be true for this experiment -->
<enabled>true</enabled>
<!-- Check credentials presence to avoid build cache errors on PR builds when credentials are not present -->
<storeEnabled>#{isTrue(env['CI']) and isTrue(env['GRADLE_ENTERPRISE_CACHE_USERNAME']) and isTrue(env['GRADLE_ENTERPRISE_CACHE_PASSWORD'])}</storeEnabled>
<storeEnabled>#{isTrue(env['CI']) and isTrue(env['GRADLE_ENTERPRISE_ACCESS_KEY'])}</storeEnabled>
</remote>
</buildCache>
</gradleEnterprise>
2 changes: 1 addition & 1 deletion CI/circle_parallel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if [ "$NODE_INDEX" = "1" ]; then
echo "Running node $NODE_INDEX ..."
java -version

sudo apt-get -y install cpanminus
sudo apt-get -y install cpanminus libmagic-dev

(cd samples/client/petstore/perl && /bin/bash ./test.bash)
(cd samples/client/petstore/ruby && mvn integration-test)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
[<img src="https://openapi-generator.tech/img/companies/alloyautomation.png" width="128" height="128">](https://runalloy.com/signup?utm_source=github&utm_medium=referral&utm_campaign=1524_openapigenerator)
[<img src="https://openapi-generator.tech/img/companies/ssstwitter.png" width="128" height="128">](https://ssstwitter.com/?utm_source=github&utm_medium=referral&utm_campaign=sponsor)
[<img src="https://openapi-generator.tech/img/companies/svix.png" width="128" height="128">](https://www.svix.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
[<img src="https://openapi-generator.tech/img/companies/litslink.png" width="128" height="128">](https://litslink.com/services/artificial-intelligence?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)


#### Thank you GoDaddy for sponsoring the domain names, Linode for sponsoring the VPS, Checkly for sponsoring the API monitoring and Gradle for sponsoring Develocity
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
generatorName: go-gin-server
outputDir: samples/server/petstore/go-gin-api-server-interface-only
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/go-gin-server
additionalProperties:
hideGenerationTimestamp: "true"
packageName: petstoreserver
interfaceOnly: true
7 changes: 0 additions & 7 deletions bin/configs/kotlin-array-simple-string-jvm-okhttp3.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions bin/configs/kotlin-default-values-jvm-okhttp3.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions bin/configs/kotlin-jvm-okhttp3-okhttp3.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions bin/configs/rust-hyper-empty-object.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
generatorName: rust
outputDir: samples/client/others/rust/hyper/emptyObject
library: hyper
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/empty-object.yaml
templateDir: modules/openapi-generator/src/main/resources/rust
additionalProperties:
supportAsync: "false"
packageName: empty-object-hyper
8 changes: 8 additions & 0 deletions bin/configs/rust-reqwest-empty-object.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
generatorName: rust
outputDir: samples/client/others/rust/reqwest/emptyObject
library: reqwest
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/empty-object.yaml
templateDir: modules/openapi-generator/src/main/resources/rust
additionalProperties:
supportAsync: "false"
packageName: empty-object-reqwest
7 changes: 7 additions & 0 deletions docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -584,3 +584,10 @@ Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer REMOVE_X_INTERNAL=true
```
- `FILTER`: When set to `operationId:addPet|getPetById` for example, it will add `x-internal:true` to operations with operationId not equal to addPet/getPetById (which will have x-internal set to false) so that these operations marked as internal won't be generated.
Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/java-okhttp/ --openapi-normalizer FILTER="operationId:addPet|getPetById"
```
1 change: 1 addition & 0 deletions docs/generators/go-gin-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|apiPath|Name of the folder that contains the Go source code| |go|
|enumClassPrefix|Prefix enum with class name| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|interfaceOnly|Whether to generate only API interface stubs without the implementation files.| |false|
|packageName|Go package name (convention: lowercase).| |openapi|
|packageVersion|Go package version.| |1.0.0|
|serverPort|The network port the generated server binds to| |8080|
Expand Down
2 changes: 1 addition & 1 deletion docs/generators/kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|generateRoomModels|Generate Android Room database models in addition to API models (JVM Volley library only)| |false|
|groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools|
|idea|Add IntellJ Idea plugin and mark Kotlin main and test folders as source folders.| |false|
|library|Library template (sub-template) to use|<dl><dt>**jvm-ktor**</dt><dd>Platform: Java Virtual Machine. HTTP client: Ktor 1.6.7. JSON processing: Gson, Jackson (default).</dd><dt>**jvm-okhttp4**</dt><dd>[DEFAULT] Platform: Java Virtual Machine. HTTP client: OkHttp 4.2.0 (Android 5.0+ and Java 8+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-okhttp3**</dt><dd>Platform: Java Virtual Machine. HTTP client: OkHttp 3.12.4 (Android 2.3+ and Java 7+). JSON processing: Moshi 1.8.0. (DEPRECATED: this option will be remove in 7.x release)</dd><dt>**jvm-spring-webclient**</dt><dd>Platform: Java Virtual Machine. HTTP: Spring 5 (or 6 with useSpringBoot3 enabled) WebClient. JSON processing: Jackson.</dd><dt>**jvm-spring-restclient**</dt><dd>Platform: Java Virtual Machine. HTTP: Spring 6 RestClient. JSON processing: Jackson.</dd><dt>**jvm-retrofit2**</dt><dd>Platform: Java Virtual Machine. HTTP client: Retrofit 2.6.2.</dd><dt>**multiplatform**</dt><dd>Platform: Kotlin multiplatform. HTTP client: Ktor 1.6.7. JSON processing: Kotlinx Serialization: 1.2.1.</dd><dt>**jvm-volley**</dt><dd>Platform: JVM for Android. HTTP client: Volley 1.2.1. JSON processing: gson 2.8.9</dd><dt>**jvm-vertx**</dt><dd>Platform: Java Virtual Machine. HTTP client: Vert.x Web Client. JSON processing: Moshi, Gson or Jackson.</dd></dl>|jvm-okhttp4|
|library|Library template (sub-template) to use|<dl><dt>**jvm-ktor**</dt><dd>Platform: Java Virtual Machine. HTTP client: Ktor 1.6.7. JSON processing: Gson, Jackson (default).</dd><dt>**jvm-okhttp4**</dt><dd>[DEFAULT] Platform: Java Virtual Machine. HTTP client: OkHttp 4.2.0 (Android 5.0+ and Java 8+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-spring-webclient**</dt><dd>Platform: Java Virtual Machine. HTTP: Spring 5 (or 6 with useSpringBoot3 enabled) WebClient. JSON processing: Jackson.</dd><dt>**jvm-spring-restclient**</dt><dd>Platform: Java Virtual Machine. HTTP: Spring 6 RestClient. JSON processing: Jackson.</dd><dt>**jvm-retrofit2**</dt><dd>Platform: Java Virtual Machine. HTTP client: Retrofit 2.6.2.</dd><dt>**multiplatform**</dt><dd>Platform: Kotlin multiplatform. HTTP client: Ktor 1.6.7. JSON processing: Kotlinx Serialization: 1.2.1.</dd><dt>**jvm-volley**</dt><dd>Platform: JVM for Android. HTTP client: Volley 1.2.1. JSON processing: gson 2.8.9</dd><dt>**jvm-vertx**</dt><dd>Platform: Java Virtual Machine. HTTP client: Vert.x Web Client. JSON processing: Moshi, Gson or Jackson.</dd></dl>|jvm-okhttp4|
|modelMutable|Create mutable models| |false|
|moshiCodeGen|Whether to enable codegen with the Moshi library. Refer to the [official Moshi doc](https://github.com/square/moshi#codegen) for more info.| |false|
|nullableReturnType|Nullable return type| |false|
Expand Down
2 changes: 1 addition & 1 deletion docs/generators/python-fastapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|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|
|fastapiImplementationPackage|python package name for the implementation code (convention: snake_case).| |openapi_server.impl|
|fastapiImplementationPackage|python package name for the implementation code (convention: snake_case).| |impl|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|packageName|python package name (convention: snake_case).| |openapi_server|
|packageVersion|python package version.| |1.0.0|
Expand Down
2 changes: 2 additions & 0 deletions modules/openapi-generator-maven-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ mvn clean compile
| `gitHost` | `openapi.generator.maven.plugin.gitHost` | The git host, e.g. gitlab.com
| `gitUserId` | `openapi.generator.maven.plugin.gitUserId` | sets git information of the project
| `gitRepoId` | `openapi.generator.maven.plugin.gitRepoId` | sets the repo ID (e.g. openapi-generator)
| `collapsedSpec` | `openapi.generator.maven.plugin.collapsedSpec` | sets the path to the collapsed single-file representation of the OpenAPI spec
| `includeCollapsedSpecInArtifacts` | `openapi.generator.maven.plugin.publishCollapsedSpec` | includes the collapsed spec in the Maven artifacts (`false` by default)
| `templateDirectory` | `openapi.generator.maven.plugin.templateDirectory` | directory with mustache templates
| `templateResourcePath` | `openapi.generator.maven.plugin.templateResourcePath` | directory with mustache templates via resource path. This option will overwrite any option defined in `templateDirectory`.
| `engine` | `openapi.generator.maven.plugin.engine` | The name of templating engine to use, "mustache" (default) or "handlebars" (beta)
Expand Down
Loading

0 comments on commit f05dd3c

Please sign in to comment.