Skip to content

Commit 37a5774

Browse files
authored
Merge branch 'master' into fix/add-x-is-optional-checks
2 parents 3178959 + fd65151 commit 37a5774

375 files changed

Lines changed: 38561 additions & 1880 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/samples-java-client-jdk11.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ on:
1818
- samples/client/petstore/java/webclient-useSingleRequestParameter/**
1919
- samples/client/others/java/jersey2-oneOf-duplicates/**
2020
- samples/client/others/java/jersey2-oneOf-Mixed/**
21-
- samples/client/petstore/java/jersey3-oneOf/**
2221
- samples/client/others/java/okhttp-gson-streaming/**
2322
- samples/client/others/java/resteasy/**
2423
- samples/client/others/java/apache-httpclient/**
@@ -41,7 +40,6 @@ on:
4140
- samples/client/petstore/java/webclient-useSingleRequestParameter/**
4241
- samples/client/others/java/jersey2-oneOf-duplicates/**
4342
- samples/client/others/java/jersey2-oneOf-Mixed/**
44-
- samples/client/petstore/java/jersey3-oneOf/**
4543
- samples/client/others/java/okhttp-gson-streaming/**
4644
- samples/client/others/java/resteasy/**
4745
- samples/client/others/java/apache-httpclient/**
@@ -111,7 +109,6 @@ jobs:
111109
- samples/client/others/java/jersey2-oneOf-Mixed/
112110
- samples/client/others/java/resttemplate-list-schema-validation/
113111
- samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/
114-
- samples/client/petstore/java/jersey3-oneOf/
115112
- samples/client/others/java/okhttp-gson-streaming/
116113
- samples/client/petstore/java/resteasy/
117114
- samples/client/petstore/java/apache-httpclient/

.github/workflows/samples-java-client-jdk17.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ on:
1717
- samples/client/others/java/restclient-enum-in-multipart/**
1818
- samples/client/others/java/restclient-sealedInterface/**
1919
- samples/client/others/java/restclient-useAbstractionForFiles/**
20+
- samples/client/petstore/java/jersey3-oneOf/**
21+
- samples/client/petstore/java/jersey3-jackson3/**
2022
pull_request:
2123
paths:
2224
- samples/client/petstore/java/resttemplate-jakarta/**
@@ -33,6 +35,8 @@ on:
3335
- samples/client/others/java/restclient-enum-in-multipart/**
3436
- samples/client/others/java/restclient-sealedInterface/**
3537
- samples/client/others/java/restclient-useAbstractionForFiles/**
38+
- samples/client/petstore/java/jersey3-oneOf/**
39+
- samples/client/petstore/java/jersey3-jackson3/**
3640
jobs:
3741
build:
3842
name: Build Java Client JDK17
@@ -64,6 +68,8 @@ jobs:
6468
- samples/client/others/java/restclient-enum-in-multipart
6569
- samples/client/others/java/restclient-sealedInterface
6670
- samples/client/others/java/restclient-useAbstractionForFiles
71+
- samples/client/petstore/java/jersey3-oneOf
72+
- samples/client/petstore/java/jersey3-jackson3
6773
steps:
6874
- uses: actions/checkout@v5
6975
- uses: actions/setup-java@v5
@@ -102,4 +108,4 @@ jobs:
102108

103109
- name: Build
104110
working-directory: ${{ matrix.sample }}
105-
run: ./gradlew build -x test
111+
run: /bin/sh gradlew build -x test --no-daemon
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# run java client tests with petstore server
2+
name: Samples Java Petsore Client JDK17
3+
4+
on:
5+
push:
6+
paths:
7+
- samples/client/petstore/java/jersey3/**
8+
pull_request:
9+
paths:
10+
- samples/client/petstore/java/jersey3/**
11+
jobs:
12+
build:
13+
name: Build Java Client JDK17
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
sample:
19+
- samples/client/petstore/java/jersey3
20+
services:
21+
petstore-api:
22+
image: swaggerapi/petstore
23+
ports:
24+
- 80:8080
25+
env:
26+
SWAGGER_HOST: http://petstore.swagger.io
27+
SWAGGER_BASE_PATH: /v2
28+
steps:
29+
- uses: actions/checkout@v5
30+
- name: Add hosts to /etc/hosts
31+
run: |
32+
sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
33+
- uses: actions/setup-java@v5
34+
with:
35+
distribution: 'temurin'
36+
java-version: 17
37+
- name: Cache maven dependencies
38+
uses: actions/cache@v5
39+
env:
40+
cache-name: maven-repository
41+
with:
42+
path: |
43+
~/.m2
44+
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
45+
- name: Build with Maven
46+
working-directory: ${{ matrix.sample }}
47+
run: mvn clean package --no-transfer-progress
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
generatorName: java
2+
outputDir: samples/client/petstore/java/jersey3-jackson3
3+
library: jersey3
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/Java
6+
additionalProperties:
7+
useBeanValidation: true
8+
artifactId: petstore-jersey3-jackson3
9+
hideGenerationTimestamp: true
10+
serverPort: "8082"
11+
dateLibrary: java8
12+
useOneOfDiscriminatorLookup: true
13+
disallowAdditionalPropertiesIfNotPresent: false
14+
gradleProperties: "\n# JVM arguments\norg.gradle.jvmargs=-Xmx2024m -XX:MaxMetaspaceSize=512m\n# set timeout\norg.gradle.daemon.idletimeout=3600000\n# show all warnings\norg.gradle.warning.mode=all"
15+
failOnUnknownProperties: true
16+
useReflectionEqualsHashCode: true
17+
useJackson3: true
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
generatorName: typescript-fetch
2+
outputDir: samples/client/others/typescript-fetch/additional-properties-in-multipart-issue
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/typescript-fetch/additional-properties-in-multipart-issue.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/typescript-fetch
5+
additionalProperties:
6+
enumPropertyNaming: "original"
7+
enumUnknownDefaultCase: true

docs/customization.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,28 @@ Into this securityScheme:
754754
type: http
755755
```
756756

757+
- `SECURITY_SCHEMES_FILTER`
758+
759+
The `SECURITY_SCHEMES_FILTER` parameter allows selective inclusion of API security schemes based on specific criteria. It removes security schemes that do **not** match the specified values, preventing them from being generated. All references to removed security schemes also deleted. Multiple filters can be separated by a semicolon.
760+
761+
### Available Filters
762+
763+
- **`key`**
764+
When set to `key:api_key|http_bearer`, security schemes **not** matching `api_key` or `http_bearer` will be marked as internal (`x-internal: true`), and excluded from generation. Matching operations will have `x-internal: false`.
765+
766+
- **`type`**
767+
When set to `type:apiKey|http`, security schemes **not** using `apiKey` or `http` types will be marked as internal (`x-internal: true`), preventing their generation.
768+
769+
### Example Usage
770+
771+
```sh
772+
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
773+
-g java \
774+
-i modules/openapi-generator/src/test/resources/3_0/petstore.yaml \
775+
-o /tmp/java-okhttp/ \
776+
--openapi-normalizer SECURITY_SCHEMES_FILTER="key:api_key|http_bearer ; type:oauth2"
777+
```
778+
757779
- `SORT_MODEL_PROPERTIES`: When set to true, model properties will be sorted alphabetically by name. This ensures deterministic code generation output regardless of property ordering in the source spec.
758780

759781
Example:

docs/generators/java-microprofile.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
6464
|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
6565
|invokerPackage|root package for generated code| |org.openapitools.client|
6666
|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|
67-
|library|library template (sub-template) to use|<dl><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.17.1</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.1.1. JSON processing: Jackson 2.17.1</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 13.2.1. JSON processing: Jackson 2.17.1 or Gson 2.10.1</dd><dt>**feign-hc5**</dt><dd>HTTP client: OpenFeign 13.2.1/HttpClient5 5.4.2. JSON processing: Jackson 2.17.1 or Gson 2.10.1</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1 (Retrofit 2.5.0) or Jackson 2.17.1. Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 5.3.33 (6.2.x if `useJakartaEe=true`, 7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.x (3.x if `useJackson3=true`)</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.1.18 (7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.17.1 (3.x if `useJackson3=true`)</dd><dt>**restclient**</dt><dd>HTTP client: Spring RestClient 6.1.6 (7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.17.1 (3.x if `useJackson3=true`)</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 4.7.6. JSON processing: Jackson 2.17.1</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.5.2. JSON processing: Jackson 2.17.1</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 2.2.0. JSON processing: Jackson 2.17.1</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured 5.3.2. JSON processing: Gson 2.10.1 or Jackson 2.17.1. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.17.1 (3.x if `useJackson3=true`). Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 2.0 (default, set desired version via `microprofileRestClientVersion=x.x.x`). JSON processing: JSON-B 1.0.2 or Jackson 2.17.1</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 5.2.1. JSON processing: Jackson 2.17.1 (3.x if `useJackson3=true`)</dd></dl>|okhttp-gson|
67+
|library|library template (sub-template) to use|<dl><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.17.1</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.1.11. JSON processing: Jackson 2.x (3.x if `useJackson3=true`, requires Java 17+)</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 13.2.1. JSON processing: Jackson 2.17.1 or Gson 2.10.1</dd><dt>**feign-hc5**</dt><dd>HTTP client: OpenFeign 13.2.1/HttpClient5 5.4.2. JSON processing: Jackson 2.17.1 or Gson 2.10.1</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1 (Retrofit 2.5.0) or Jackson 2.17.1. Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 5.3.33 (6.2.x if `useJakartaEe=true`, 7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.x (3.x if `useJackson3=true`)</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.1.18 (7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.17.1 (3.x if `useJackson3=true`)</dd><dt>**restclient**</dt><dd>HTTP client: Spring RestClient 6.1.6 (7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.17.1 (3.x if `useJackson3=true`)</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 4.7.6. JSON processing: Jackson 2.17.1</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.5.2. JSON processing: Jackson 2.17.1</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 2.2.0. JSON processing: Jackson 2.17.1</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured 5.3.2. JSON processing: Gson 2.10.1 or Jackson 2.17.1. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.17.1 (3.x if `useJackson3=true`). Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 2.0 (default, set desired version via `microprofileRestClientVersion=x.x.x`). JSON processing: JSON-B 1.0.2 or Jackson 2.17.1</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 5.2.1. JSON processing: Jackson 2.17.1 (3.x if `useJackson3=true`)</dd></dl>|okhttp-gson|
6868
|licenseName|The name of the license| |Unlicense|
6969
|licenseUrl|The URL of the license| |http://unlicense.org|
7070
|microprofileFramework|Framework for microprofile. Possible values &quot;kumuluzee&quot;| |null|
@@ -98,7 +98,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
9898
|useDeductionForOneOfInterfaces|Annotate discriminator-free oneOf interfaces with Jackson's @JsonTypeInfo(use = Id.DEDUCTION) and @JsonSubTypes so the concrete subtype is resolved from the JSON field set rather than a type-tag property. Has no effect when a discriminator is present (name-based resolution is used instead). Requires subtypes to have structurally distinct sets of properties.| |false|
9999
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
100100
|useGzipFeature|Send gzip-encoded requests| |false|
101-
|useJackson3|Use Jackson 3 instead of Jackson 2. Supported for 'native' and 'apache-httpclient' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).| |false|
101+
|useJackson3|Use Jackson 3 instead of Jackson 2. Supported for 'native', 'apache-httpclient', and 'jersey3' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).| |false|
102102
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
103103
|useJspecify|Use Jspecify for null checks. Only supported for [native, restclient, resttemplate, webclient]| |false|
104104
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson support this option.| |false|

0 commit comments

Comments
 (0)