forked from loafle/openapi-generator-original
Compare commits
98 Commits
typescript
...
8.0.x
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b23399f9a | ||
|
|
131fd518fb | ||
|
|
9cfd26e7a5 | ||
|
|
37afe57f0f | ||
|
|
c93ec54a16 | ||
|
|
3c880719e1 | ||
|
|
fb023b192b | ||
|
|
408706ef9d | ||
|
|
362d3b5aa1 | ||
|
|
9a673ea09a | ||
|
|
8950892652 | ||
|
|
1c62c0385f | ||
|
|
0e70d1f068 | ||
|
|
6ad5864d28 | ||
|
|
fef84d956e | ||
|
|
3e263ce3fc | ||
|
|
08e2653935 | ||
|
|
e40d3228aa | ||
|
|
b5d5e572e0 | ||
|
|
e542b06869 | ||
|
|
f44bc30d20 | ||
|
|
aaf3ea2528 | ||
|
|
e59a4ab8f8 | ||
|
|
ebf72a3772 | ||
|
|
47abf82164 | ||
|
|
75cbebd2d2 | ||
|
|
2f5529a184 | ||
|
|
045f4b6067 | ||
|
|
cfcc2c89d6 | ||
|
|
3dc3ee08bc | ||
|
|
0177ceda56 | ||
|
|
1367a16d6d | ||
|
|
a330a1f38e | ||
|
|
0002f8c506 | ||
|
|
c8587bb31d | ||
|
|
9ae8775987 | ||
|
|
c05bedb148 | ||
|
|
875fdb50bd | ||
|
|
49e33188cf | ||
|
|
94264e5598 | ||
|
|
a81b736b24 | ||
|
|
75e3be39cb | ||
|
|
304ff96577 | ||
|
|
7f01a354a5 | ||
|
|
b705972cad | ||
|
|
897a4e79d2 | ||
|
|
3e6c13ede8 | ||
|
|
75f4faae0c | ||
|
|
722be84cac | ||
|
|
7b52da5d57 | ||
|
|
8938f9dea1 | ||
|
|
2940d3219c | ||
|
|
9948ed2cfa | ||
|
|
a4292c5db5 | ||
|
|
42b0b20891 | ||
|
|
5fdcd4857b | ||
|
|
005d5b0232 | ||
|
|
ba056dbf10 | ||
|
|
705d853baa | ||
|
|
011acc9950 | ||
|
|
5612852fb6 | ||
|
|
039f0b85f6 | ||
|
|
1841f57863 | ||
|
|
5da4f50dac | ||
|
|
8ab3bb491b | ||
|
|
a3912b7239 | ||
|
|
0820edee5d | ||
|
|
8f7cce716f | ||
|
|
b84770af16 | ||
|
|
72cdb7020e | ||
|
|
7f6d2d8801 | ||
|
|
aef9142c2c | ||
|
|
77737009e7 | ||
|
|
0b1b3f531e | ||
|
|
b897a99ebb | ||
|
|
c8caa7cf49 | ||
|
|
4fa124b023 | ||
|
|
dab0a16621 | ||
|
|
add5c2eec7 | ||
|
|
21ad242ceb | ||
|
|
ff2e173de8 | ||
|
|
03beb3732e | ||
|
|
59d799baa2 | ||
|
|
9c4664a12c | ||
|
|
376505c25d | ||
|
|
5d61f71cdd | ||
|
|
daa4886865 | ||
|
|
860fd26449 | ||
|
|
20cfce0b4a | ||
|
|
4eaac3d152 | ||
|
|
c9da04cb65 | ||
|
|
99ca67d703 | ||
|
|
bfc784e391 | ||
|
|
c289982848 | ||
|
|
f0f13cf932 | ||
|
|
3922973e85 | ||
|
|
29461aad1c | ||
|
|
2e69d7d950 |
4
.github/workflows/linux.yaml
vendored
4
.github/workflows/linux.yaml
vendored
@@ -45,7 +45,7 @@ jobs:
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Setup Maven
|
||||
uses: s4u/setup-maven-action@v1.13.0
|
||||
uses: s4u/setup-maven-action@v1.14.0
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
maven-version: 3.8.8
|
||||
@@ -87,7 +87,7 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Maven
|
||||
uses: s4u/setup-maven-action@v1.13.0
|
||||
uses: s4u/setup-maven-action@v1.14.0
|
||||
with:
|
||||
java-version: 11
|
||||
maven-version: 3.8.8
|
||||
|
||||
1
.github/workflows/maven-plugin-tests.yaml
vendored
1
.github/workflows/maven-plugin-tests.yaml
vendored
@@ -39,6 +39,7 @@ jobs:
|
||||
run: |
|
||||
./mvnw clean install -DskipTests -Dmaven.javadoc.skip=true
|
||||
./mvnw --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/java-client.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
./mvnw --no-snapshot-updates --quiet clean install -f modules/openapi-generator-maven-plugin/examples/multi-module/sample-external-ref-schema/pom.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
./mvnw --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
./mvnw --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/kotlin.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
./mvnw --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/spring.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
|
||||
11
.github/workflows/samples-cpp-qt-client.yaml
vendored
11
.github/workflows/samples-cpp-qt-client.yaml
vendored
@@ -3,10 +3,10 @@ name: Samples cpp qt client
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'samples/client/petstore/cpp-qt/**'
|
||||
- "samples/client/petstore/cpp-qt/**"
|
||||
pull_request:
|
||||
paths:
|
||||
- 'samples/client/petstore/cpp-qt/**'
|
||||
- "samples/client/petstore/cpp-qt/**"
|
||||
|
||||
env:
|
||||
GRADLE_VERSION: 6.9
|
||||
@@ -16,9 +16,6 @@ jobs:
|
||||
name: Build cpp qt client
|
||||
strategy:
|
||||
matrix:
|
||||
qt-version:
|
||||
- '5.15.2'
|
||||
- '6.5.3'
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macOS-latest
|
||||
@@ -29,8 +26,8 @@ jobs:
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: ${{ matrix.qt-version }}
|
||||
tools: ${{ matrix.tools }}
|
||||
version: "6.7.1"
|
||||
target: "desktop"
|
||||
- name: Build
|
||||
working-directory: "samples/client/petstore/cpp-qt"
|
||||
run: cmake . && cmake --build .
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
# - samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v4.0.0
|
||||
- uses: actions/setup-dotnet@v4.0.1
|
||||
with:
|
||||
dotnet-version: 3.1.*
|
||||
- name: Build
|
||||
|
||||
2
.github/workflows/samples-dotnet.yaml
vendored
2
.github/workflows/samples-dotnet.yaml
vendored
@@ -34,7 +34,7 @@ jobs:
|
||||
- samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v4.0.0
|
||||
- uses: actions/setup-dotnet@v4.0.1
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Build
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
- samples/client/echo_api/csharp-restsharp/
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v4.0.0
|
||||
- uses: actions/setup-dotnet@v4.0.1
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
- name: Run echo server
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
- samples/client/petstore/csharp/restsharp/net6/ParameterMappings/
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v4.0.0
|
||||
- uses: actions/setup-dotnet@v4.0.1
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
- name: Build
|
||||
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
- samples/server/petstore/aspnetcore-6.0-useSwashBuckle
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v4.0.0
|
||||
- uses: actions/setup-dotnet@v4.0.1
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
- name: Build
|
||||
|
||||
36
.github/workflows/samples-dotnet8-server.yaml
vendored
Normal file
36
.github/workflows/samples-dotnet8-server.yaml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Samples C# .Net 8 Server
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- samples/server/petstore/aspnetcore-8.0/**
|
||||
- samples/server/petstore/aspnetcore-8.0-*/**
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/server/petstore/aspnetcore-8.0/**
|
||||
- samples/server/petstore/aspnetcore-8.0-*/**
|
||||
jobs:
|
||||
build:
|
||||
name: Build .Net 8 servers
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
- samples/server/petstore/aspnetcore-8.0
|
||||
- samples/server/petstore/aspnetcore-8.0-NewtonsoftFalse
|
||||
- samples/server/petstore/aspnetcore-8.0-nullableReferenceTypes
|
||||
- samples/server/petstore/aspnetcore-8.0-pocoModels
|
||||
- samples/server/petstore/aspnetcore-8.0-project4Models
|
||||
- samples/server/petstore/aspnetcore-8.0-useSwashBuckle
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v4.0.1
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Build
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: dotnet build Org.OpenAPITools.sln
|
||||
- name: Test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: dotnet test Org.OpenAPITools.sln
|
||||
3
.github/workflows/samples-haskell.yaml
vendored
3
.github/workflows/samples-haskell.yaml
vendored
@@ -5,11 +5,13 @@ on:
|
||||
paths:
|
||||
- samples/server/petstore/haskell-yesod/**
|
||||
- samples/server/petstore/haskell-servant/**
|
||||
- samples/server/others/haskell-servant-ping/**
|
||||
- samples/client/petstore/haskell-http-client/**
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/server/petstore/haskell-yesod/**
|
||||
- samples/server/petstore/haskell-servant/**
|
||||
- samples/server/others/haskell-servant-ping/**
|
||||
- samples/client/petstore/haskell-http-client/**
|
||||
jobs:
|
||||
build:
|
||||
@@ -22,6 +24,7 @@ jobs:
|
||||
# servers
|
||||
- samples/server/petstore/haskell-yesod/
|
||||
- samples/server/petstore/haskell-servant/
|
||||
- samples/server/others/haskell-servant-ping/
|
||||
- samples/client/petstore/haskell-http-client/
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -3,10 +3,10 @@ name: Java Client (Echo API) JDK17
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- samples/client/echo_api/java/restclient
|
||||
- samples/client/echo_api/java/**
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/client/echo_api/java/restclient
|
||||
- samples/client/echo_api/java/**
|
||||
jobs:
|
||||
build:
|
||||
name: Build Java Client JDK17
|
||||
@@ -16,6 +16,11 @@ jobs:
|
||||
matrix:
|
||||
sample:
|
||||
# clients
|
||||
- samples/client/echo_api/java/apache-httpclient
|
||||
- samples/client/echo_api/java/native
|
||||
- samples/client/echo_api/java/feign-gson
|
||||
- samples/client/echo_api/java/resttemplate
|
||||
- samples/client/echo_api/java/resteasy
|
||||
- samples/client/echo_api/java/restclient
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -3,8 +3,6 @@ name: Samples Java Server
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
# java-camel is tested locally for the time being
|
||||
#- 'samples/server/petstore/java-camel/**'
|
||||
- 'samples/server/petstore/java-vertx-web/**'
|
||||
- 'samples/server/petstore/java-inflector/**'
|
||||
- 'samples/server/petstore/java-pkmst/**'
|
||||
@@ -13,7 +11,6 @@ on:
|
||||
- 'samples/server/petstore/java-microprofile/**'
|
||||
pull_request:
|
||||
paths:
|
||||
#- 'samples/server/petstore/java-camel/**'
|
||||
- 'samples/server/petstore/java-vertx-web/**'
|
||||
- 'samples/server/petstore/java-inflector/**'
|
||||
- 'samples/server/petstore/java-pkmst/**'
|
||||
@@ -28,7 +25,6 @@ jobs:
|
||||
matrix:
|
||||
sample:
|
||||
# servers
|
||||
#- samples/server/petstore/java-camel/
|
||||
- samples/server/petstore/java-vertx-web/
|
||||
- samples/server/petstore/java-inflector/
|
||||
- samples/server/petstore/java-pkmst/
|
||||
|
||||
6
.github/workflows/samples-jdk17.yaml
vendored
6
.github/workflows/samples-jdk17.yaml
vendored
@@ -9,8 +9,10 @@ on:
|
||||
- samples/client/petstore/spring-http-interface-reactive/**
|
||||
- samples/client/petstore/spring-http-interface/**
|
||||
- samples/client/petstore/java/webclient-jakarta/**
|
||||
- samples/client/petstore/java/microprofile-rest-client-outer-enum/**
|
||||
# servers
|
||||
- samples/openapi3/server/petstore/springboot-3/**
|
||||
- samples/server/petstore/java-camel/**
|
||||
- samples/server/petstore/java-helidon-server/v3/mp/**
|
||||
- samples/server/petstore/java-helidon-server/v3/se/**
|
||||
pull_request:
|
||||
@@ -22,8 +24,10 @@ on:
|
||||
- samples/client/petstore/spring-http-interface-reactive/**
|
||||
- samples/client/petstore/spring-http-interface/**
|
||||
- samples/client/petstore/java/webclient-jakarta/**
|
||||
- samples/client/petstore/java/microprofile-rest-client-outer-enum/**
|
||||
# servers
|
||||
- samples/openapi3/server/petstore/springboot-3/**
|
||||
- samples/server/petstore/java-camel/**
|
||||
- samples/server/petstore/java-helidon-server/v3/mp/**
|
||||
- samples/server/petstore/java-helidon-server/v3/se/**
|
||||
jobs:
|
||||
@@ -41,8 +45,10 @@ jobs:
|
||||
- samples/client/petstore/spring-http-interface-reactive
|
||||
- samples/client/petstore/spring-http-interface
|
||||
- samples/client/petstore/java/webclient-jakarta
|
||||
- samples/client/petstore/java/microprofile-rest-client-outer-enum
|
||||
# servers
|
||||
- samples/openapi3/server/petstore/springboot-3
|
||||
- samples/server/petstore/java-camel/
|
||||
- samples/server/petstore/java-helidon-server/v3/mp/
|
||||
- samples/server/petstore/java-helidon-server/v3/se
|
||||
- samples/client/petstore/spring-http-interface-reactive
|
||||
|
||||
2
.github/workflows/samples-julia.yaml
vendored
2
.github/workflows/samples-julia.yaml
vendored
@@ -30,7 +30,7 @@ jobs:
|
||||
# Using develop mode to install package so that it is easier to modify the package test files
|
||||
julia -e "using Pkg; Pkg.develop(\"OpenAPI\");"
|
||||
cd ~/.julia/dev/OpenAPI
|
||||
git checkout v0.1.14
|
||||
git checkout v0.1.25
|
||||
cd $currdir
|
||||
rm -rf ~/.julia/dev/OpenAPI/test/client/openapigenerator_petstore_v3/petstore
|
||||
rm -rf ~/.julia/dev/OpenAPI/test/server/openapigenerator_petstore_v3/petstore
|
||||
|
||||
@@ -29,6 +29,7 @@ jobs:
|
||||
sample:
|
||||
# server
|
||||
- samples/server/petstore/kotlin-springboot-3
|
||||
- samples/server/petstore/kotlin-springboot-delegate-nodefaults
|
||||
- samples/server/petstore/kotlin-springboot-request
|
||||
- samples/server/petstore/kotlin-springboot-request-cookie
|
||||
- samples/server/petstore/kotlin-server/javalin
|
||||
|
||||
1
.github/workflows/samples-kotlin-server.yaml
vendored
1
.github/workflows/samples-kotlin-server.yaml
vendored
@@ -29,6 +29,7 @@ jobs:
|
||||
sample:
|
||||
# server
|
||||
- samples/server/petstore/kotlin-springboot
|
||||
- samples/server/petstore/kotlin-springboot-multipart-request-model
|
||||
- samples/server/petstore/kotlin-springboot-bigdecimal-default
|
||||
- samples/server/petstore/kotlin-springboot-delegate
|
||||
- samples/server/petstore/kotlin-springboot-modelMutable
|
||||
|
||||
@@ -18,11 +18,11 @@ jobs:
|
||||
- samples/client/echo_api/python
|
||||
- samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent
|
||||
python-version:
|
||||
- "3.7"
|
||||
- "3.8"
|
||||
- "3.9"
|
||||
- "3.10"
|
||||
- "3.11"
|
||||
- "3.12"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: python -m pytest
|
||||
run: python -m unittest discover
|
||||
|
||||
- name: mypy
|
||||
working-directory: ${{ matrix.sample }}
|
||||
|
||||
@@ -15,7 +15,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version:
|
||||
- "3.7"
|
||||
- "3.8"
|
||||
- "3.9"
|
||||
- "3.10"
|
||||
|
||||
@@ -15,7 +15,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version:
|
||||
- "3.7"
|
||||
- "3.8"
|
||||
- "3.9"
|
||||
- "3.10"
|
||||
|
||||
2
.github/workflows/windows.yaml
vendored
2
.github/workflows/windows.yaml
vendored
@@ -39,7 +39,7 @@ jobs:
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
- name: Setup Maven
|
||||
uses: s4u/setup-maven-action@v1.13.0
|
||||
uses: s4u/setup-maven-action@v1.14.0
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
maven-version: 3.8.8
|
||||
|
||||
11
Dockerfile
11
Dockerfile
@@ -10,6 +10,16 @@ COPY ./LICENSE ${GEN_DIR}
|
||||
# Required to compile openapi-generator
|
||||
COPY ./google_checkstyle.xml ${GEN_DIR}
|
||||
|
||||
# All poms are copied, then we go offline, to allow for better caching of code changes without fetching all dependencies each time
|
||||
COPY ./modules/openapi-generator-gradle-plugin/pom.xml ${GEN_DIR}/modules/openapi-generator-gradle-plugin/
|
||||
COPY ./modules/openapi-generator-maven-plugin/pom.xml ${GEN_DIR}/modules/openapi-generator-maven-plugin/
|
||||
COPY ./modules/openapi-generator-online/pom.xml ${GEN_DIR}/modules/openapi-generator-online/
|
||||
COPY ./modules/openapi-generator-cli/pom.xml ${GEN_DIR}/modules/openapi-generator-cli/
|
||||
COPY ./modules/openapi-generator-core/pom.xml ${GEN_DIR}/modules/openapi-generator-core/
|
||||
COPY ./modules/openapi-generator/pom.xml ${GEN_DIR}/modules/openapi-generator/
|
||||
COPY ./pom.xml ${GEN_DIR}
|
||||
RUN mvn dependency:go-offline
|
||||
|
||||
# Modules are copied individually here to allow for caching of docker layers between major.minor versions
|
||||
COPY ./modules/openapi-generator-gradle-plugin ${GEN_DIR}/modules/openapi-generator-gradle-plugin
|
||||
COPY ./modules/openapi-generator-maven-plugin ${GEN_DIR}/modules/openapi-generator-maven-plugin
|
||||
@@ -17,7 +27,6 @@ COPY ./modules/openapi-generator-online ${GEN_DIR}/modules/openapi-generator-onl
|
||||
COPY ./modules/openapi-generator-cli ${GEN_DIR}/modules/openapi-generator-cli
|
||||
COPY ./modules/openapi-generator-core ${GEN_DIR}/modules/openapi-generator-core
|
||||
COPY ./modules/openapi-generator ${GEN_DIR}/modules/openapi-generator
|
||||
COPY ./pom.xml ${GEN_DIR}
|
||||
|
||||
# Pre-compile openapi-generator-cli
|
||||
RUN mvn -B -am -pl "modules/openapi-generator-cli" package
|
||||
|
||||
30
README.md
30
README.md
@@ -15,7 +15,7 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.7.0`):
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.8.0`):
|
||||
[](https://app.travis-ci.com/github/OpenAPITools/openapi-generator/builds)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
|
||||
@@ -84,13 +84,13 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
|
||||
|
||||
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification) (both 2.0 and 3.0 are supported). Currently, the following languages/frameworks are supported:
|
||||
|
||||
| | Languages/Frameworks |
|
||||
| -------------------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient 4.x, Apache HttpClient 5.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client, Helidon), **Jetbrains HTTP Client**, **Julia**, **k6**, **Kotlin**, **Lua**, **N4JS**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient, pekko), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (9.x - 18.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs), **XoJo**, **Zapier** |
|
||||
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Julia**, **Kotlin** (Spring Boot, [Ktor](https://github.com/ktorio/ktor), [Vert.x](https://vertx.io/)), **PHP** ([Flight](https://docs.flightphp.com/), Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), [Cask](https://github.com/com-lihaoyi/cask), Scalatra) |
|
||||
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
|
||||
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
|
||||
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Postman Collection**, **Protocol Buffer**, **WSDL** |
|
||||
| | Languages/Frameworks |
|
||||
| -------------------------------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient 4.x, Apache HttpClient 5.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, Spring 6 RestClient, MicroProfile Rest Client, Helidon), **Jetbrains HTTP Client**, **Julia**, **k6**, **Kotlin**, **Lua**, **N4JS**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient, pekko), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (9.x - 18.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs), **XoJo**, **Zapier** |
|
||||
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Julia**, **Kotlin** (Spring Boot, [Ktor](https://github.com/ktorio/ktor), [Vert.x](https://vertx.io/)), **PHP** ([Flight](https://docs.flightphp.com/), Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), [Cask](https://github.com/com-lihaoyi/cask), Scalatra) |
|
||||
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
|
||||
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
|
||||
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Postman Collection**, **Protocol Buffer**, **WSDL** |
|
||||
|
||||
## Table of contents
|
||||
|
||||
@@ -128,8 +128,8 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
||||
|
||||
| OpenAPI Generator Version | Release Date | Notes |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
|
||||
| 7.7.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.7.0-SNAPSHOT/) | 20.06.2024 | Minor release with breaking changes (with fallback) |
|
||||
| [7.6.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.6.0) (latest stable release) | 20.05.2024 | Minor release with breaking changes (with fallback) |
|
||||
| 7.8.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.8.0-SNAPSHOT/) | 09.08.2024 | Minor release with breaking changes (with fallback) |
|
||||
| [7.7.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.7.0) (latest stable release) | 02.07.2024 | Minor release with breaking changes (with fallback) |
|
||||
| [6.6.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v6.6.0) | 11.05.2023 | Minor release with breaking changes (with fallback) |
|
||||
| [5.4.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.4.0) | 31.01.2022 | Minor release with breaking changes (with fallback) |
|
||||
| [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) |
|
||||
@@ -192,16 +192,16 @@ See the different versions of the [openapi-generator-cli](https://search.maven.o
|
||||
<!-- RELEASE_VERSION -->
|
||||
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 11 runtime at a minimum):
|
||||
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.6.0/openapi-generator-cli-7.6.0.jar`
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.7.0/openapi-generator-cli-7.7.0.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
```sh
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.6.0/openapi-generator-cli-7.6.0.jar -O openapi-generator-cli.jar
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.7.0/openapi-generator-cli-7.7.0.jar -O openapi-generator-cli.jar
|
||||
```
|
||||
|
||||
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
|
||||
```
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.6.0/openapi-generator-cli-7.6.0.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.7.0/openapi-generator-cli-7.7.0.jar
|
||||
```
|
||||
|
||||
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
|
||||
@@ -599,6 +599,7 @@ Here is a list of community-contributed IDE plug-ins that integrate with OpenAPI
|
||||
Here are some companies/projects (alphabetical order) using OpenAPI Generator in production. To add your company/project to the list, please visit [README.md](README.md) and click on the icon to edit the page.
|
||||
|
||||
- [Aalborg University](https://www.aau.dk)
|
||||
- [act coding](https://github.com/actcoding)
|
||||
- [Adaptant Solutions AG](https://www.adaptant.io/)
|
||||
- [adesso SE](https://www.adesso.de/)
|
||||
- [Adyen](https://www.adyen.com/)
|
||||
@@ -932,6 +933,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- 2023-06-28 - [Generate API contract using OpenAPI Generator Maven plugin](https://huongdanjava.com/generate-api-contract-using-openapi-generator-maven-plugin.html) by [Khanh Nguyen](https://huongdanjava.com/)
|
||||
- 2023-06-30 - [Generate Client SDKs with OpenApi Generator in Springboot](https://medium.com/@ramavathvinayak/generate-client-sdks-with-openapi-generator-in-springboot-f9f012e73c0b) by [Vinayak Ramavath](https://medium.com/@ramavathvinayak)
|
||||
- 2023-12-10 - [UnityでOpenAPI Generatorを使う](https://www.youtube.com/watch?v=CbNwKVV5LRM) by [Soup Tori](https://www.youtube.com/@souptori8417)
|
||||
- 2024-01-24 - [Comment générer des stubs wiremock avec openapi generator](https://www.youtube.com/watch?v=0jhONfBrcKw) by [Alexis Couvreur](https://github.com/acouvreur)
|
||||
- 2024-03-04 - [Generating TypeScript Types with OpenAPI for REST API Consumption](https://www.pullrequest.com/blog/generating-typescript-types-with-openapi-for-rest-api-consumption/) by [PullRequest](https://www.pullrequest.com/)
|
||||
- 2024-03-07 - [Fully typed Web Apps with OpenAPI (Part 1)](https://medium.com/@gfox1984/fully-typed-web-apps-with-openapi-part-1-595d55766670) by [Guillaume Renard](https://medium.com/@gfox1984)
|
||||
- 2024-03-08 - [Laravel OpenAPIによる "辛くない" スキーマ駆動開発](https://fortee.jp/phperkaigi-2024/proposal/9e2e6c38-d078-4efa-99b4-83ebf9033b34) by [KentarouTakeda](https://twitter.com/KentarouTakeda)
|
||||
@@ -996,6 +998,7 @@ Here is a list of template creators:
|
||||
* Java (okhttp-gson): @xhh
|
||||
* Java (RestTemplate): @nbruno
|
||||
* Java (Spring 5 WebClient): @daonomic
|
||||
* Java (Spring 6 RestClient): @nicklas2751
|
||||
* Java (RESTEasy): @gayathrigs
|
||||
* Java (Vertx): @lopesmcc
|
||||
* Java (Google APIs Client Library): @charlescapps
|
||||
@@ -1084,6 +1087,7 @@ Here is a list of template creators:
|
||||
* Java Vert.x: @lwlee2608
|
||||
* Java Micronaut: @andriy-dmytruk
|
||||
* Java Helidon: @spericas @tjquinno @tvallin
|
||||
* Java WireMock: [@acouvreur](https://github.com/acouvreur)
|
||||
* JAX-RS RestEasy: @chameleon82
|
||||
* JAX-RS CXF: @hiveship
|
||||
* JAX-RS CXF (CDI): @nickcmaynard
|
||||
|
||||
9
bin/configs/aspnetcore-8.0-NewtonsoftFalse.yaml
Normal file
9
bin/configs/aspnetcore-8.0-NewtonsoftFalse.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
generatorName: aspnetcore
|
||||
outputDir: samples/server/petstore/aspnetcore-8.0-NewtonsoftFalse
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
|
||||
additionalProperties:
|
||||
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
|
||||
aspnetCoreVersion: "8.0"
|
||||
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
|
||||
useNewtonsoft: false
|
||||
9
bin/configs/aspnetcore-8.0-nullableReferenceTypes.yaml
Normal file
9
bin/configs/aspnetcore-8.0-nullableReferenceTypes.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
generatorName: aspnetcore
|
||||
outputDir: samples/server/petstore/aspnetcore-8.0-nullableReferenceTypes
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
|
||||
additionalProperties:
|
||||
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
|
||||
aspnetCoreVersion: "8.0"
|
||||
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
|
||||
nullableReferenceTypes: true
|
||||
9
bin/configs/aspnetcore-8.0-pocoModels.yaml
Normal file
9
bin/configs/aspnetcore-8.0-pocoModels.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
generatorName: aspnetcore
|
||||
outputDir: samples/server/petstore/aspnetcore-8.0-pocoModels
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
|
||||
additionalProperties:
|
||||
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
|
||||
aspnetCoreVersion: "8.0"
|
||||
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
|
||||
pocoModels: true
|
||||
9
bin/configs/aspnetcore-8.0-project4Models.yaml
Normal file
9
bin/configs/aspnetcore-8.0-project4Models.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
generatorName: aspnetcore
|
||||
outputDir: samples/server/petstore/aspnetcore-8.0-project4Models
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
|
||||
additionalProperties:
|
||||
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
|
||||
aspnetCoreVersion: "8.0"
|
||||
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
|
||||
useSeparateModelProject: true
|
||||
11
bin/configs/aspnetcore-8.0-useSwashBuckle.yaml
Normal file
11
bin/configs/aspnetcore-8.0-useSwashBuckle.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
generatorName: aspnetcore
|
||||
outputDir: samples/server/petstore/aspnetcore-8.0-useSwashBuckle
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
|
||||
additionalProperties:
|
||||
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
|
||||
aspnetCoreVersion: "8.0"
|
||||
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
|
||||
useSwashBuckle: false
|
||||
buildTarget: library
|
||||
isLibrary: true
|
||||
8
bin/configs/aspnetcore-8.0.yaml
Normal file
8
bin/configs/aspnetcore-8.0.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
generatorName: aspnetcore
|
||||
outputDir: samples/server/petstore/aspnetcore-8.0
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
|
||||
additionalProperties:
|
||||
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
|
||||
aspnetCoreVersion: "8.0"
|
||||
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
|
||||
4
bin/configs/haskell-servant-ping.yaml
Normal file
4
bin/configs/haskell-servant-ping.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
generatorName: haskell
|
||||
outputDir: samples/server/others/haskell-servant-ping
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/ping.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/haskell-servant
|
||||
@@ -0,0 +1,8 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/petstore/java/microprofile-rest-client-outer-enum
|
||||
library: microprofile
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/outerEnum.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: microprofile-rest-client
|
||||
configKeyFromClassName: true
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: k6
|
||||
outputDir: samples/client/petstore/k6
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/k6/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/k6
|
||||
additionalProperties:
|
||||
appName: PetstoreClient
|
||||
|
||||
14
bin/configs/kotlin-spring-boot-delegate-nodefaults.yaml
Normal file
14
bin/configs/kotlin-spring-boot-delegate-nodefaults.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
generatorName: kotlin-spring
|
||||
outputDir: samples/server/petstore/kotlin-springboot-delegate-nodefaults
|
||||
library: spring-boot
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
|
||||
additionalProperties:
|
||||
documentationProvider: none
|
||||
annotationLibrary: swagger2
|
||||
useSwaggerUI: "true"
|
||||
delegatePattern: "true"
|
||||
skipDefaultInterface: "true"
|
||||
beanValidations: "true"
|
||||
requestMappingMode: "api_interface"
|
||||
useSpringBoot3: "true"
|
||||
@@ -8,5 +8,6 @@ additionalProperties:
|
||||
annotationLibrary: swagger2
|
||||
useSwaggerUI: "true"
|
||||
delegatePattern: "true"
|
||||
appendRequestToHandler: "true"
|
||||
beanValidations: "true"
|
||||
requestMappingMode: none
|
||||
|
||||
13
bin/configs/kotlin-spring-boot-integer-enum.yaml
Normal file
13
bin/configs/kotlin-spring-boot-integer-enum.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
generatorName: kotlin-spring
|
||||
outputDir: samples/server/petstore/kotlin-springboot-integer-enum
|
||||
library: spring-boot
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/issue19244_integer_enum.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
|
||||
additionalProperties:
|
||||
interfaceOnly: "true"
|
||||
skipDefaultInterface: "true"
|
||||
useTags: "true"
|
||||
useSpringBoot3: "true"
|
||||
annotationLibrary: none
|
||||
documentationProvider: none
|
||||
enumPropertyNaming: UPPERCASE
|
||||
@@ -0,0 +1,5 @@
|
||||
generatorName: kotlin-spring
|
||||
outputDir: samples/server/petstore/kotlin-springboot-multipart-request-model
|
||||
library: spring-boot
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue_15251_multipart_request_model.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
|
||||
8
bin/configs/rust-hyper0x-petstore.yaml
Normal file
8
bin/configs/rust-hyper0x-petstore.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
generatorName: rust
|
||||
outputDir: samples/client/petstore/rust/hyper0x/petstore
|
||||
library: hyper0x
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/rust
|
||||
additionalProperties:
|
||||
supportAsync: "false"
|
||||
packageName: petstore-hyper0x
|
||||
@@ -8,3 +8,4 @@ additionalProperties:
|
||||
projectName: ts-petstore-client
|
||||
moduleName: petstore
|
||||
supportsES6: true
|
||||
enumType: stringUnion
|
||||
|
||||
@@ -7,3 +7,4 @@ additionalProperties:
|
||||
npmName: ts-petstore-client
|
||||
projectName: ts-petstore-client
|
||||
moduleName: petstore
|
||||
enumType: stringUnion
|
||||
|
||||
@@ -7,3 +7,4 @@ additionalProperties:
|
||||
npmName: ts-petstore-client
|
||||
projectName: ts-petstore-client
|
||||
moduleName: petstore
|
||||
enumType: stringUnion
|
||||
|
||||
@@ -8,3 +8,4 @@ additionalProperties:
|
||||
useObjectParameters: true
|
||||
projectName: ts-petstore-client
|
||||
moduleName: petstore
|
||||
enumType: stringUnion
|
||||
|
||||
4
bin/configs/typescript-fetch-oneOf.yaml
Normal file
4
bin/configs/typescript-fetch-oneOf.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
generatorName: typescript-fetch
|
||||
outputDir: samples/client/petstore/typescript-fetch/builds/oneOf
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/typescript-fetch/oneOf.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript-fetch
|
||||
7
bin/configs/typescript-fetch-self-import-issue.yaml
Normal file
7
bin/configs/typescript-fetch-self-import-issue.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
generatorName: typescript-fetch
|
||||
outputDir: samples/client/others/typescript-fetch/self-import-issue
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/typescript-fetch/self-import-issue.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript-fetch
|
||||
additionalProperties:
|
||||
typescriptThreePlus: "true"
|
||||
legacyDiscriminatorBehavior: "false"
|
||||
@@ -18,7 +18,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|aspnetCoreVersion|ASP.NET Core version: 6.0, 5.0, 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)|<dl><dt>**2.0**</dt><dd>ASP.NET Core 2.0</dd><dt>**2.1**</dt><dd>ASP.NET Core 2.1</dd><dt>**2.2**</dt><dd>ASP.NET Core 2.2</dd><dt>**3.0**</dt><dd>ASP.NET Core 3.0</dd><dt>**3.1**</dt><dd>ASP.NET Core 3.1</dd><dt>**5.0**</dt><dd>ASP.NET Core 5.0</dd><dt>**6.0**</dt><dd>ASP.NET Core 6.0</dd></dl>|3.1|
|
||||
|aspnetCoreVersion|ASP.NET Core version: 6.0, 5.0, 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)|<dl><dt>**2.0**</dt><dd>ASP.NET Core 2.0</dd><dt>**2.1**</dt><dd>ASP.NET Core 2.1</dd><dt>**2.2**</dt><dd>ASP.NET Core 2.2</dd><dt>**3.0**</dt><dd>ASP.NET Core 3.0</dd><dt>**3.1**</dt><dd>ASP.NET Core 3.1</dd><dt>**5.0**</dt><dd>ASP.NET Core 5.0</dd><dt>**6.0**</dt><dd>ASP.NET Core 6.0</dd><dt>**7.0**</dt><dd>ASP.NET Core 7.0</dd><dt>**8.0**</dt><dd>ASP.NET Core 8.0</dd></dl>|8.0|
|
||||
|buildTarget|Target to build an application or library|<dl><dt>**program**</dt><dd>Generate code for a standalone server</dd><dt>**library**</dt><dd>Generate code for a server abstract class library</dd></dl>|program|
|
||||
|classModifier|Class Modifier for controller classes: Empty string or abstract.| ||
|
||||
|compatibilityVersion|ASP.Net Core CompatibilityVersion| |Version_2_2|
|
||||
@@ -45,7 +45,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|sourceFolder|source folder for generated code| |src|
|
||||
|swashbuckleVersion|Swashbuckle version: 3.0.0 (deprecated), 4.0.0 (deprecated), 5.0.0 (deprecated), 6.4.0|<dl><dt>**3.0.0**</dt><dd>Swashbuckle 3.0.0</dd><dt>**4.0.0**</dt><dd>Swashbuckle 4.0.0</dd><dt>**5.0.0**</dt><dd>Swashbuckle 5.0.0</dd><dt>**6.4.0**</dt><dd>Swashbuckle 6.4.0</dd></dl>|3.0.0|
|
||||
|swashbuckleVersion|Swashbuckle version: 3.0.0 (deprecated), 4.0.0 (deprecated), 5.0.0 (deprecated), 6.4.0|<dl><dt>**3.0.0**</dt><dd>Swashbuckle 3.0.0</dd><dt>**4.0.0**</dt><dd>Swashbuckle 4.0.0</dd><dt>**5.0.0**</dt><dd>Swashbuckle 5.0.0</dd><dt>**6.4.0**</dt><dd>Swashbuckle 6.4.0</dd></dl>|6.4.0|
|
||||
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|
||||
|useDateTimeForDate|Use DateTime to model date properties even if DateOnly supported. (.net 6.0+ only)| |false|
|
||||
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|
||||
|
||||
@@ -46,7 +46,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|serverPort|configuration the port in which the sever is to run on| |8080|
|
||||
|serviceImplementation|generate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generated| |false|
|
||||
|serviceInterface|generate service interfaces to go alongside controllers. In most cases this option would be used to update an existing project, so not to override implementations. Useful to help facilitate the generation gap pattern| |false|
|
||||
|skipDefaultInterface|Whether to skip generation of default implementations for interfaces| |false|
|
||||
|skipDefaultInterface|Whether to skip generation of default implementations for interfaces (Api interfaces or Delegate interfaces depending on the delegatePattern option)| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|
||||
|sourceFolder|source folder for generated code| |src/main/kotlin|
|
||||
@@ -57,6 +57,18 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|
||||
|useTags|Whether to use tags for creating interface and controller class names| |false|
|
||||
|
||||
## SUPPORTED VENDOR EXTENSIONS
|
||||
|
||||
| Extension name | Description | Applicable for | Default value |
|
||||
| -------------- | ----------- | -------------- | ------------- |
|
||||
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|
||||
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|
||||
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|
||||
|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL|
|
||||
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|
||||
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
|
||||
@@ -22,7 +22,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bestFitInt|Use best fitting integer type where minimum or maximum is set| |false|
|
||||
|enumNameSuffix|Suffix that will be appended to all enum names.| ||
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|library|library template (sub-template) to use.|<dl><dt>**hyper**</dt><dd>HTTP client: Hyper.</dd><dt>**reqwest**</dt><dd>HTTP client: Reqwest.</dd></dl>|reqwest|
|
||||
|library|library template (sub-template) to use.|<dl><dt>**hyper**</dt><dd>HTTP client: Hyper (v1.x).</dd><dt>**hyper0x**</dt><dd>HTTP client: Hyper (v0.x).</dd><dt>**reqwest**</dt><dd>HTTP client: Reqwest.</dd></dl>|reqwest|
|
||||
|packageName|Rust package name (convention: lowercase).| |openapi|
|
||||
|packageVersion|Rust package version.| |1.0.0|
|
||||
|preferUnsignedInt|Prefer unsigned integers where minimum value is >= 0| |false|
|
||||
|
||||
@@ -20,6 +20,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|axiosVersion|Use this property to override the axios version in package.json| |^1.6.1|
|
||||
|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|
|
||||
|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum|
|
||||
|
||||
@@ -24,6 +24,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum|
|
||||
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
|
||||
|enumPropertyNamingReplaceSpecialChar|Set to true to replace '-' and '+' symbols with 'minus_' and 'plus_' in enum of type string| |false|
|
||||
|enumType|Specify the enum type which should be used in the client code.|<dl><dt>**stringUnion**</dt><dd>Union of literal string types</dd><dt>**enum**</dt><dd>Typescript's [string enums](https://www.typescriptlang.org/docs/handbook/enums.html#string-enums)</dd></dl>|enum|
|
||||
|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|
|
||||
|fileContentDataType|Specifies the type to use for the content of a file - i.e. Blob (Browser, Deno) / Buffer (node)| |Buffer|
|
||||
|framework|Specify the framework which should be used in the client code.|<dl><dt>**fetch-api**</dt><dd>fetch-api</dd><dt>**jquery**</dt><dd>jquery</dd></dl>|fetch-api|
|
||||
|
||||
@@ -103,18 +103,18 @@ docker run --rm \
|
||||
<!-- RELEASE_VERSION -->
|
||||
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 11 runtime at a minimum):
|
||||
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.2.0/openapi-generator-cli-7.2.0.jar`
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.7.0/openapi-generator-cli-7.7.0.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
|
||||
```bash
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.2.0/openapi-generator-cli-7.2.0.jar -O openapi-generator-cli.jar
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.7.0/openapi-generator-cli-7.7.0.jar -O openapi-generator-cli.jar
|
||||
```
|
||||
|
||||
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
|
||||
|
||||
```powershell
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.2.0/openapi-generator-cli-7.2.0.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.7.0/openapi-generator-cli-7.7.0.jar
|
||||
```
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.7.0-SNAPSHOT</version>
|
||||
<version>8.0.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.7.0-SNAPSHOT</version>
|
||||
<version>8.0.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -97,7 +97,7 @@ task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.Valid
|
||||
[source,group]
|
||||
----
|
||||
plugins {
|
||||
id "org.openapi.generator" version "7.5.0"
|
||||
id "org.openapi.generator" version "7.7.0"
|
||||
}
|
||||
----
|
||||
|
||||
@@ -113,7 +113,7 @@ buildscript {
|
||||
// url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:7.2.0"
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:7.7.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -759,7 +759,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath('org.openapitools:openapi-generator-gradle-plugin:7.2.0') {
|
||||
classpath('org.openapitools:openapi-generator-gradle-plugin:7.7.0') {
|
||||
exclude group: 'com.google.guava'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=7.7.0-SNAPSHOT
|
||||
openApiGeneratorVersion=8.0.0-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
# BEGIN placeholders
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.7.0-SNAPSHOT</version>
|
||||
<version>8.0.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -19,5 +19,5 @@ gradle generateGoWithInvalidSpec # expected outcome: BUILD FAILED
|
||||
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:
|
||||
|
||||
```bash
|
||||
gradle -PopenApiGeneratorVersion=7.2.0 openApiValidate
|
||||
gradle -PopenApiGeneratorVersion=7.7.0 openApiValidate
|
||||
```
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=7.7.0-SNAPSHOT
|
||||
openApiGeneratorVersion=8.0.0-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
@@ -12,7 +12,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.5.0</version>
|
||||
<version>7.7.0</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.7.0-SNAPSHOT</version>
|
||||
<version>8.0.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.7.0-SNAPSHOT</version>
|
||||
<version>8.0.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.7.0-SNAPSHOT</version>
|
||||
<version>8.0.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -27,9 +27,15 @@
|
||||
<artifactId>sample-schema</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>sample-external-ref-schema</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default</id>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
@@ -48,6 +54,30 @@
|
||||
<dateLibrary>joda</dateLibrary>
|
||||
</configOptions>
|
||||
|
||||
<!-- override the default library to jersey2 -->
|
||||
<library>jersey2</library>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>external-ref</id>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<!-- specify the OpenAPI spec -->
|
||||
<inputSpec>external-ref/petstore.yaml</inputSpec>
|
||||
|
||||
<!-- target to generate java client code -->
|
||||
<generatorName>java</generatorName>
|
||||
|
||||
<!-- hint: if you want to generate java server code, e.g. based on Spring Boot,
|
||||
you can use the following target: <generatorName>spring</generatorName> -->
|
||||
|
||||
<!-- pass any necessary config options -->
|
||||
<configOptions>
|
||||
<dateLibrary>joda</dateLibrary>
|
||||
</configOptions>
|
||||
|
||||
<!-- override the default library to jersey2 -->
|
||||
<library>jersey2</library>
|
||||
</configuration>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>sample-external-ref-schema</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>sample-external-ref-schema</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
|
||||
<!-- this POM is not a module of multi-module project to keep resources out of classpath-->
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,105 @@
|
||||
openapi: 3.0.0
|
||||
servers:
|
||||
- url: 'http://petstore.swagger.io/v2'
|
||||
info:
|
||||
description: Sample file with just two endpoints and one schema (defined in an external file $ref)
|
||||
version: 1.0.0
|
||||
title: OpenAPI Petstore
|
||||
paths:
|
||||
/pet:
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: Add a new pet to the store
|
||||
description: ''
|
||||
operationId: addPet
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
'405':
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
'/pet/{petId}':
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Find pet by ID
|
||||
description: Returns a single pet
|
||||
operationId: getPetById
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet to return
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Pet not found
|
||||
security:
|
||||
- api_key: []
|
||||
delete:
|
||||
tags:
|
||||
- pet
|
||||
summary: Deletes a pet
|
||||
description: ''
|
||||
operationId: deletePet
|
||||
parameters:
|
||||
- name: api_key
|
||||
in: header
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
- name: petId
|
||||
in: path
|
||||
description: Pet id to delete
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid pet value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
components:
|
||||
requestBodies:
|
||||
Pet:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
description: Pet object that needs to be added to the store
|
||||
required: true
|
||||
schemas:
|
||||
Pet:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
@@ -0,0 +1,29 @@
|
||||
title: a Pet
|
||||
description: A pet for sale in the pet store
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- photoUrls
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
example: doggie
|
||||
photoUrls:
|
||||
type: array
|
||||
xml:
|
||||
name: photoUrl
|
||||
wrapped: true
|
||||
items:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
description: pet status in the store
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
xml:
|
||||
name: Pet
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.7.0-SNAPSHOT</version>
|
||||
<version>8.0.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.7.0-SNAPSHOT</version>
|
||||
<version>8.0.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.7.0-SNAPSHOT</version>
|
||||
<version>8.0.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.7.0-SNAPSHOT</version>
|
||||
<version>8.0.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -60,7 +60,7 @@ import static org.openapitools.codegen.config.CodegenConfiguratorUtils.*;
|
||||
* Goal which generates client/server code from a OpenAPI json/yaml definition.
|
||||
*/
|
||||
@SuppressWarnings({"unused", "MismatchedQueryAndUpdateOfCollection"})
|
||||
@Mojo(name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true)
|
||||
@Mojo(name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true)
|
||||
public class CodeGenMojo extends AbstractMojo {
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(CodeGenMojo.class);
|
||||
@@ -623,13 +623,7 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
}
|
||||
|
||||
if (isNotEmpty(inputSpec)) {
|
||||
URL url = inputSpecRemoteUrl();
|
||||
|
||||
if ((! inputSpecFile.exists()) && url != null) {
|
||||
configurator.setInputSpec(url.toString());
|
||||
} else {
|
||||
configurator.setInputSpec(inputSpec);
|
||||
}
|
||||
configurator.setInputSpec(inputSpec);
|
||||
}
|
||||
|
||||
if (isNotEmpty(gitHost)) {
|
||||
@@ -1015,35 +1009,15 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to parse inputSpec setting string into URL (truly remote or resource)
|
||||
* Try to parse inputSpec setting string into URL
|
||||
* @return A valid URL or null if inputSpec is not a valid URL
|
||||
*/
|
||||
private URL inputSpecRemoteUrl() {
|
||||
URL url = dependencyClassLoader().getResource(inputSpec);
|
||||
|
||||
if (url == null) {
|
||||
try {
|
||||
url = new URI(FilenameUtils.separatorsToUnix(inputSpec)).toURL();
|
||||
} catch (URISyntaxException | MalformedURLException | IllegalArgumentException e) {
|
||||
}
|
||||
try {
|
||||
return new URI(FilenameUtils.separatorsToUnix(inputSpec)).toURL();
|
||||
} catch (URISyntaxException | MalformedURLException | IllegalArgumentException ignored) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
private ClassLoader dependencyClassLoader() {
|
||||
List<URL> list = new ArrayList<>();
|
||||
|
||||
for (Artifact artifact : project.getArtifacts()) {
|
||||
try {
|
||||
if (artifact.isResolved() && artifact.getType().equals("jar")) {
|
||||
list.add(new URL("jar:" + artifact.getFile().toURI() + "!/"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
return new URLClassLoader(list.toArray(new URL[] { }), getClass().getClassLoader());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,8 +60,12 @@ public class CodeGenMojoTest extends BaseTestCase {
|
||||
testCommonConfiguration("resource");
|
||||
}
|
||||
|
||||
public void testCommonConfigurationWithURLInputSpec() throws Exception {
|
||||
testCommonConfiguration("url");
|
||||
public void testCommonConfigurationWithResourceExternalRefInputSpec() throws Exception {
|
||||
testCommonConfiguration("resource-external-ref");
|
||||
}
|
||||
|
||||
public void testCommonConfigurationWithJARInputSpec() throws Exception {
|
||||
testCommonConfiguration("jar");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -32,23 +32,30 @@
|
||||
<profile>
|
||||
<id>resource</id>
|
||||
<properties>
|
||||
<inputSpec>petstore.yaml</inputSpec>
|
||||
<inputSpec>petstore-on-classpath.yaml</inputSpec>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>url</id>
|
||||
<id>resource-external-ref</id>
|
||||
<properties>
|
||||
<!-- Directory schemas inside schema-external-ref to not shadow JARs schema directory -->
|
||||
<inputSpec>schema-external-ref/petstore-on-classpath.yaml</inputSpec>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jar</id>
|
||||
<properties>
|
||||
<inputSpec>jar:file:${basedir}/local-repo/petstore/schema/1/schema-1.jar!/petstore.yaml</inputSpec>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>petstore</groupId>
|
||||
<artifactId>schema</artifactId>
|
||||
<version>1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>petstore</groupId>
|
||||
<artifactId>schema</artifactId>
|
||||
<version>1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>common-maven</finalName>
|
||||
<plugins>
|
||||
|
||||
@@ -0,0 +1,617 @@
|
||||
openapi: 3.0.0
|
||||
servers:
|
||||
- url: 'http://petstore.swagger.io/v2'
|
||||
info:
|
||||
description: >-
|
||||
This is a sample server Petstore server. For this sample, you can use the api key
|
||||
`special-key` to test the authorization filters.
|
||||
version: 1.0.0
|
||||
title: OpenAPI Petstore
|
||||
license:
|
||||
name: Apache-2.0
|
||||
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
|
||||
tags:
|
||||
- name: pet
|
||||
description: Everything about your Pets
|
||||
- name: store
|
||||
description: Access to Petstore orders
|
||||
- name: user
|
||||
description: Operations about user
|
||||
paths:
|
||||
/pet:
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: Add a new pet to the store
|
||||
description: ''
|
||||
operationId: addPet
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
'405':
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
put:
|
||||
tags:
|
||||
- pet
|
||||
summary: Update an existing pet
|
||||
description: ''
|
||||
operationId: updatePet
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Pet not found
|
||||
'405':
|
||||
description: Validation exception
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
/pet/findByStatus:
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Finds Pets by status
|
||||
description: Multiple status values can be provided with comma separated strings
|
||||
operationId: findPetsByStatus
|
||||
parameters:
|
||||
- name: status
|
||||
in: query
|
||||
description: Status values that need to be considered for filter
|
||||
required: true
|
||||
style: form
|
||||
explode: false
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
default: available
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
'400':
|
||||
description: Invalid status value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'read:pets'
|
||||
/pet/findByTags:
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Finds Pets by tags
|
||||
description: >-
|
||||
Multiple tags can be provided with comma separated strings. Use tag1,
|
||||
tag2, tag3 for testing.
|
||||
operationId: findPetsByTags
|
||||
parameters:
|
||||
- name: tags
|
||||
in: query
|
||||
description: Tags to filter by
|
||||
required: true
|
||||
style: form
|
||||
explode: false
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
'400':
|
||||
description: Invalid tag value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'read:pets'
|
||||
deprecated: true
|
||||
'/pet/{petId}':
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Find pet by ID
|
||||
description: Returns a single pet
|
||||
operationId: getPetById
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet to return
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Pet not found
|
||||
security:
|
||||
- api_key: []
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: Updates a pet in the store with form data
|
||||
description: ''
|
||||
operationId: updatePetWithForm
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet that needs to be updated
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'405':
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
content:
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
description: Updated name of the pet
|
||||
type: string
|
||||
status:
|
||||
description: Updated status of the pet
|
||||
type: string
|
||||
delete:
|
||||
tags:
|
||||
- pet
|
||||
summary: Deletes a pet
|
||||
description: ''
|
||||
operationId: deletePet
|
||||
parameters:
|
||||
- name: api_key
|
||||
in: header
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
- name: petId
|
||||
in: path
|
||||
description: Pet id to delete
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid pet value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
'/pet/{petId}/uploadImage':
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: uploads an image
|
||||
description: ''
|
||||
operationId: uploadFile
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet to update
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponse'
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
additionalMetadata:
|
||||
description: Additional data to pass to server
|
||||
type: string
|
||||
file:
|
||||
description: file to upload
|
||||
type: string
|
||||
format: binary
|
||||
/store/inventory:
|
||||
get:
|
||||
tags:
|
||||
- store
|
||||
summary: Returns pet inventories by status
|
||||
description: Returns a map of status codes to quantities
|
||||
operationId: getInventory
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: integer
|
||||
format: int32
|
||||
security:
|
||||
- api_key: []
|
||||
/store/order:
|
||||
post:
|
||||
tags:
|
||||
- store
|
||||
summary: Place an order for a pet
|
||||
description: ''
|
||||
operationId: placeOrder
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: 'schemas/Order.yaml'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'schemas/Order.yaml'
|
||||
'400':
|
||||
description: Invalid Order
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'schemas/Order.yaml'
|
||||
description: order placed for purchasing the pet
|
||||
required: true
|
||||
'/store/order/{orderId}':
|
||||
get:
|
||||
tags:
|
||||
- store
|
||||
summary: Find purchase order by ID
|
||||
description: >-
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values
|
||||
will generate exceptions
|
||||
operationId: getOrderById
|
||||
parameters:
|
||||
- name: orderId
|
||||
in: path
|
||||
description: ID of pet that needs to be fetched
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 1
|
||||
maximum: 5
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: 'schemas/Order.yaml'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'schemas/Order.yaml'
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Order not found
|
||||
delete:
|
||||
tags:
|
||||
- store
|
||||
summary: Delete purchase order by ID
|
||||
description: >-
|
||||
For valid response try integer IDs with value < 1000. Anything above
|
||||
1000 or nonintegers will generate API errors
|
||||
operationId: deleteOrder
|
||||
parameters:
|
||||
- name: orderId
|
||||
in: path
|
||||
description: ID of the order that needs to be deleted
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Order not found
|
||||
/user:
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Create user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: createUser
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'schemas/User.yaml'
|
||||
description: Created user object
|
||||
required: true
|
||||
/user/createWithArray:
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Creates list of users with given input array
|
||||
description: ''
|
||||
operationId: createUsersWithArrayInput
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/UserArray'
|
||||
/user/createWithList:
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Creates list of users with given input array
|
||||
description: ''
|
||||
operationId: createUsersWithListInput
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/UserArray'
|
||||
/user/login:
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Logs user into the system
|
||||
description: ''
|
||||
operationId: loginUser
|
||||
parameters:
|
||||
- name: username
|
||||
in: query
|
||||
description: The user name for login
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
|
||||
- name: password
|
||||
in: query
|
||||
description: The password for login in clear text
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
headers:
|
||||
Set-Cookie:
|
||||
description: >-
|
||||
Cookie authentication key for use with the `api_key`
|
||||
apiKey authentication.
|
||||
schema:
|
||||
type: string
|
||||
example: AUTH_KEY=abcde12345; Path=/; HttpOnly
|
||||
X-Rate-Limit:
|
||||
description: calls per hour allowed by the user
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
X-Expires-After:
|
||||
description: date in UTC when token expires
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: string
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
'400':
|
||||
description: Invalid username/password supplied
|
||||
/user/logout:
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Logs out current logged in user session
|
||||
description: ''
|
||||
operationId: logoutUser
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
'/user/{username}':
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Get user by user name
|
||||
description: ''
|
||||
operationId: getUserByName
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: The name that needs to be fetched. Use user1 for testing.
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: 'schemas/User.yaml'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'schemas/User.yaml'
|
||||
'400':
|
||||
description: Invalid username supplied
|
||||
'404':
|
||||
description: User not found
|
||||
put:
|
||||
tags:
|
||||
- user
|
||||
summary: Updated user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: updateUser
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: name that need to be deleted
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid user supplied
|
||||
'404':
|
||||
description: User not found
|
||||
security:
|
||||
- api_key: []
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'schemas/User.yaml'
|
||||
description: Updated user object
|
||||
required: true
|
||||
delete:
|
||||
tags:
|
||||
- user
|
||||
summary: Delete user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: deleteUser
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: The name that needs to be deleted
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid username supplied
|
||||
'404':
|
||||
description: User not found
|
||||
security:
|
||||
- api_key: []
|
||||
externalDocs:
|
||||
description: Find out more about Swagger
|
||||
url: 'http://swagger.io'
|
||||
components:
|
||||
requestBodies:
|
||||
UserArray:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'schemas/User.yaml'
|
||||
description: List of user object
|
||||
required: true
|
||||
Pet:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: 'schemas/Pet.yaml'
|
||||
description: Pet object that needs to be added to the store
|
||||
required: true
|
||||
securitySchemes:
|
||||
petstore_auth:
|
||||
type: oauth2
|
||||
flows:
|
||||
implicit:
|
||||
authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
|
||||
scopes:
|
||||
'write:pets': modify pets in your account
|
||||
'read:pets': read your pets
|
||||
api_key:
|
||||
type: apiKey
|
||||
name: api_key
|
||||
in: header
|
||||
schemas:
|
||||
ApiResponse:
|
||||
title: An uploaded response
|
||||
description: Describes the result of uploading an image resource
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int32
|
||||
type:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
@@ -0,0 +1,12 @@
|
||||
title: Pet category
|
||||
description: A category for a pet
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
|
||||
xml:
|
||||
name: Category
|
||||
@@ -0,0 +1,28 @@
|
||||
title: Pet Order
|
||||
description: An order for a pets from the pet store
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
petId:
|
||||
type: integer
|
||||
format: int64
|
||||
quantity:
|
||||
type: integer
|
||||
format: int32
|
||||
shipDate:
|
||||
type: string
|
||||
format: date-time
|
||||
status:
|
||||
type: string
|
||||
description: Order Status
|
||||
enum:
|
||||
- placed
|
||||
- approved
|
||||
- delivered
|
||||
complete:
|
||||
type: boolean
|
||||
default: false
|
||||
xml:
|
||||
name: Order
|
||||
@@ -0,0 +1,38 @@
|
||||
title: a Pet
|
||||
description: A pet for sale in the pet store
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- photoUrls
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
category:
|
||||
$ref: 'Category.yaml'
|
||||
name:
|
||||
type: string
|
||||
example: doggie
|
||||
photoUrls:
|
||||
type: array
|
||||
xml:
|
||||
name: photoUrl
|
||||
wrapped: true
|
||||
items:
|
||||
type: string
|
||||
tags:
|
||||
type: array
|
||||
xml:
|
||||
name: tag
|
||||
wrapped: true
|
||||
items:
|
||||
$ref: 'Tag.yaml'
|
||||
status:
|
||||
type: string
|
||||
description: pet status in the store
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
xml:
|
||||
name: Pet
|
||||
@@ -0,0 +1,11 @@
|
||||
title: Pet Tag
|
||||
description: A tag for a pet
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
xml:
|
||||
name: Tag
|
||||
@@ -0,0 +1,25 @@
|
||||
title: a User
|
||||
description: A User who is purchasing from the pet store
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
username:
|
||||
type: string
|
||||
firstName:
|
||||
type: string
|
||||
lastName:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
phone:
|
||||
type: string
|
||||
userStatus:
|
||||
type: integer
|
||||
format: int32
|
||||
description: User Status
|
||||
xml:
|
||||
name: User
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.7.0-SNAPSHOT</version>
|
||||
<version>8.0.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.7.0-SNAPSHOT</version>
|
||||
<version>8.0.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -1833,6 +1833,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
specialCharReplacements.put("!=", "Not_Equal");
|
||||
specialCharReplacements.put("<>", "Not_Equal");
|
||||
specialCharReplacements.put("~=", "Tilde_Equal");
|
||||
specialCharReplacements.put("==", "Double_Equal");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6751,33 +6752,33 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* reads propertyKey from additionalProperties, converts it to a boolean and
|
||||
* writes it back to additionalProperties to be usable as a boolean in
|
||||
* mustache files.
|
||||
*
|
||||
* @param propertyKey property key
|
||||
* @param stringSetter the setter function reference
|
||||
* @return property value as String or default if not found
|
||||
*/
|
||||
public String convertPropertyToStringAndWriteBack(String propertyKey, Consumer<String> stringSetter) {
|
||||
return convertPropertyToTypeAndWriteBack(propertyKey, Function.identity(), stringSetter);
|
||||
}
|
||||
|
||||
/**
|
||||
* reads propertyKey from additionalProperties, converts it to a boolean and
|
||||
* writes it back to additionalProperties to be usable as a boolean in
|
||||
* reads propertyKey from additionalProperties, converts it to a string and
|
||||
* writes it back to additionalProperties to be usable as a string in
|
||||
* mustache files.
|
||||
*
|
||||
* @param propertyKey property key
|
||||
* @param stringSetter the setter function reference
|
||||
* @return property value as String or null if not found
|
||||
*/
|
||||
public <T> T convertPropertyToTypeAndWriteBack(String propertyKey, Function<String, T> converter, Consumer<T> stringSetter) {
|
||||
public String convertPropertyToStringAndWriteBack(String propertyKey, Consumer<String> stringSetter) {
|
||||
return convertPropertyToTypeAndWriteBack(propertyKey, Function.identity(), stringSetter);
|
||||
}
|
||||
|
||||
/**
|
||||
* reads propertyKey from additionalProperties, converts it to T and
|
||||
* writes it back to additionalProperties to be usable as T in
|
||||
* mustache files.
|
||||
*
|
||||
* @param propertyKey property key
|
||||
* @param genericTypeSetter the setter function reference
|
||||
* @return property value as instance of type T or null if not found
|
||||
*/
|
||||
public <T> T convertPropertyToTypeAndWriteBack(String propertyKey, Function<String, T> converter, Consumer<T> genericTypeSetter) {
|
||||
if (additionalProperties.containsKey(propertyKey)) {
|
||||
String value = additionalProperties.get(propertyKey).toString();
|
||||
T result = converter.apply(value);
|
||||
writePropertyBack(propertyKey, result);
|
||||
stringSetter.accept(result);
|
||||
genericTypeSetter.accept(result);
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -96,12 +96,8 @@ public class DefaultGenerator implements Generator {
|
||||
private String contextPath;
|
||||
private Map<String, String> generatorPropertyDefaults = new HashMap<>();
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Retrieves an instance to the configured template processor, available after user-defined options are
|
||||
* applied via
|
||||
* .
|
||||
*
|
||||
* @return A configured {@link TemplateProcessor}, or null.
|
||||
*/
|
||||
@Getter protected TemplateProcessor templateProcessor = null;
|
||||
|
||||
|
||||
@@ -111,8 +111,8 @@ public interface IJsonSchemaValidationProperties {
|
||||
* - <code>categoryOneOf</code> is a parameter of class <code>GetAccountVideos_categoryOneOf_parameter</code>, a model parameter that correctly prefixed by its namespace: <code>org::openapitools::server::model::GetAccountVideos_categoryOneOf_parameter</code><br>
|
||||
* - but that <code>GetAccountVideos_categoryOneOf_parameter</code> class is inside an <code>std::optional</code><br>
|
||||
* <br>
|
||||
* Then a correct generation of that parameter can be (for C++) <code>const std::optional<org::openapitools::server::model::GetAccountVideos_categoryOneOf_parameter> &categoryOneOf</code><br>
|
||||
* but using #isModel alone without #isOptional in mustache might produce <code>const org::openapitools::server::model::std::optional<org::openapitools::server::model::GetAccountVideos_categoryOneOf_parameter> &categoryOneOf</code> instead, that do not compile.
|
||||
* Then a correct generation of that parameter can be (for C++) <code>const std::optional<org::openapitools::server::model::GetAccountVideos_categoryOneOf_parameter> &categoryOneOf</code><br>
|
||||
* but using #isModel alone without #isOptional in mustache might produce <code>const org::openapitools::server::model::std::optional<org::openapitools::server::model::GetAccountVideos_categoryOneOf_parameter> &categoryOneOf</code> instead, that do not compile.
|
||||
*/
|
||||
boolean getIsOptional();
|
||||
void setIsOptional(boolean isOptional);
|
||||
|
||||
@@ -316,7 +316,7 @@ public class InlineModelResolver {
|
||||
if (schema.getAdditionalProperties() instanceof Schema) {
|
||||
Schema inner = (Schema) schema.getAdditionalProperties();
|
||||
if (inner != null) {
|
||||
String schemaName = resolveModelName(schema.getTitle(), modelPrefix + this.inlineSchemaOptions.get("MAP_ITEM_SUFFIX"));
|
||||
String schemaName = resolveModelName(inner.getTitle(), modelPrefix + this.inlineSchemaOptions.get("MAP_ITEM_SUFFIX"));
|
||||
// Recurse to create $refs for inner models
|
||||
gatherInlineModels(inner, schemaName);
|
||||
if (isModelNeeded(inner)) {
|
||||
@@ -1015,4 +1015,4 @@ public class InlineModelResolver {
|
||||
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,11 +208,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
instantiationTypes.put("array", "List");
|
||||
instantiationTypes.put("list", "List");
|
||||
instantiationTypes.put("map", "Dictionary");
|
||||
|
||||
this.setSortParamsByRequiredFlag(true);
|
||||
|
||||
// do it only on newer libraries to avoid breaking changes
|
||||
// this.setSortModelPropertiesByRequiredFlag(true);
|
||||
}
|
||||
|
||||
public void setUseCollection(boolean useCollection) {
|
||||
|
||||
@@ -347,6 +347,12 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
return toModelName(type);
|
||||
}
|
||||
|
||||
private String getItemsTypeDeclaration(Schema items) {
|
||||
String itemsTypeDeclaration = getTypeDeclaration(items);
|
||||
String nullable = items.getNullable() != null && items.getNullable() && !itemsTypeDeclaration.endsWith("?") ? "?" : "";
|
||||
return itemsTypeDeclaration + nullable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the type declaration of the property
|
||||
*
|
||||
@@ -359,7 +365,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
Schema<?> target = ModelUtils.isGenerateAliasAsModel() ? p : schema;
|
||||
if (ModelUtils.isArraySchema(target)) {
|
||||
Schema<?> items = ModelUtils.getSchemaItems( schema);
|
||||
return getSchemaType(target) + "<" + getTypeDeclaration(items) + ">";
|
||||
return getSchemaType(target) + "<" + getItemsTypeDeclaration(items) + ">";
|
||||
} else if (ModelUtils.isMapSchema(target)) {
|
||||
// Note: ModelUtils.isMapSchema(p) returns true when p is a composed schema that also defines
|
||||
// additionalproperties: true
|
||||
|
||||
@@ -629,7 +629,11 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
public String getTypeDeclaration(Schema p) {
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
Schema<?> items = ModelUtils.getSchemaItems(p);
|
||||
return getSchemaType(p) + "<" + getTypeDeclaration(unaliasSchema(items)) + ">";
|
||||
String postfix = "";
|
||||
if (Boolean.TRUE.equals(items.getNullable())) {
|
||||
postfix = " | null";
|
||||
}
|
||||
return getSchemaType(p) + "<" + getTypeDeclaration(unaliasSchema(items)) + postfix + ">";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema<?> inner = getSchemaAdditionalProperties(p);
|
||||
String nullSafeSuffix = getNullSafeAdditionalProps() ? " | undefined" : "";
|
||||
|
||||
@@ -186,7 +186,9 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
|
||||
aspnetCoreVersion.addEnum("3.1", "ASP.NET Core 3.1");
|
||||
aspnetCoreVersion.addEnum("5.0", "ASP.NET Core 5.0");
|
||||
aspnetCoreVersion.addEnum("6.0", "ASP.NET Core 6.0");
|
||||
aspnetCoreVersion.setDefault("3.1");
|
||||
aspnetCoreVersion.addEnum("7.0", "ASP.NET Core 7.0");
|
||||
aspnetCoreVersion.addEnum("8.0", "ASP.NET Core 8.0");
|
||||
aspnetCoreVersion.setDefault("8.0");
|
||||
aspnetCoreVersion.setOptValue(aspnetCoreVersion.getDefault());
|
||||
cliOptions.add(aspnetCoreVersion);
|
||||
|
||||
@@ -194,7 +196,7 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
|
||||
swashbuckleVersion.addEnum("4.0.0", "Swashbuckle 4.0.0");
|
||||
swashbuckleVersion.addEnum("5.0.0", "Swashbuckle 5.0.0");
|
||||
swashbuckleVersion.addEnum("6.4.0", "Swashbuckle 6.4.0");
|
||||
swashbuckleVersion.setDefault("3.0.0");
|
||||
swashbuckleVersion.setDefault("6.4.0");
|
||||
swashbuckleVersion.setOptValue(swashbuckleVersion.getDefault());
|
||||
cliOptions.add(swashbuckleVersion);
|
||||
|
||||
@@ -427,7 +429,7 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
|
||||
supportingFiles.add(new SupportingFile("typeConverter.mustache", packageFolder + File.separator + "Converters", "CustomEnumConverter.cs"));
|
||||
}
|
||||
|
||||
if (aspnetCoreVersion.getOptValue().startsWith("3.") || aspnetCoreVersion.getOptValue().startsWith("5.0") || aspnetCoreVersion.getOptValue().startsWith("6.")) {
|
||||
if (!aspnetCoreVersion.getOptValue().startsWith("2.")) {
|
||||
supportingFiles.add(new SupportingFile("OpenApi" + File.separator + "TypeExtensions.mustache", packageFolder + File.separator + "OpenApi", "TypeExtensions.cs"));
|
||||
}
|
||||
|
||||
@@ -681,7 +683,7 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
|
||||
private void setAspnetCoreVersion(String packageFolder) {
|
||||
setCliOption(aspnetCoreVersion);
|
||||
|
||||
if (aspnetCoreVersion.getOptValue().startsWith("3.") || aspnetCoreVersion.getOptValue().startsWith("5.0") || aspnetCoreVersion.getOptValue().startsWith("6.")) {
|
||||
if (!aspnetCoreVersion.getOptValue().startsWith("2.")) {
|
||||
compatibilityVersion = null;
|
||||
} else if ("2.0".equals(aspnetCoreVersion.getOptValue())) {
|
||||
compatibilityVersion = null;
|
||||
@@ -698,6 +700,8 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
|
||||
|
||||
private String determineTemplateVersion(String frameworkVersion) {
|
||||
switch (frameworkVersion) {
|
||||
case "8.0":
|
||||
case "7.0":
|
||||
case "6.0":
|
||||
case "5.0":
|
||||
case "3.1":
|
||||
|
||||
@@ -745,8 +745,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
if (GENERICHOST.equals(getLibrary())) {
|
||||
setLibrary(GENERICHOST);
|
||||
additionalProperties.put("useGenericHost", true);
|
||||
// all c# libraries should be doing this, but we only do it here to avoid breaking changes
|
||||
this.setSortModelPropertiesByRequiredFlag(true);
|
||||
} else if (RESTSHARP.equals(getLibrary())) {
|
||||
additionalProperties.put("useRestSharp", true);
|
||||
needsCustomHttpMethod = true;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ElixirClientCodegen extends DefaultCodegen {
|
||||
|
||||
private final Pattern simpleAtomPattern = Pattern.compile("\\A(?:(?:[_@\\p{Alpha}][_@\\p{Alnum}]*[?!]?)|-)\\z");
|
||||
|
||||
protected String apiVersion = "1.0.0";
|
||||
@Setter protected String packageVersion = "1.0.0";
|
||||
@Setter protected String moduleName;
|
||||
protected static final String defaultModuleName = "OpenAPI.Client";
|
||||
|
||||
@@ -147,12 +147,6 @@ public class ElixirClientCodegen extends DefaultCodegen {
|
||||
"__ENV__",
|
||||
"__CALLER__"));
|
||||
|
||||
/**
|
||||
* Additional Properties. These values can be passed to the templates and
|
||||
* are available in models, apis, and supporting files
|
||||
*/
|
||||
additionalProperties.put("apiVersion", apiVersion);
|
||||
|
||||
/**
|
||||
* Supporting Files. You can write single files for the generator with the
|
||||
* entire object tree available. If the input file has a suffix of `.mustache
|
||||
@@ -301,6 +295,10 @@ public class ElixirClientCodegen extends DefaultCodegen {
|
||||
if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
|
||||
setModuleName((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||
}
|
||||
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) {
|
||||
setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION));
|
||||
}
|
||||
additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -136,10 +136,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
@Setter protected String errorObjectType;
|
||||
protected String authFolder;
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Serialization library.
|
||||
*
|
||||
* @return 'gson' or 'jackson'
|
||||
*/
|
||||
@Getter protected String serializationLibrary = null;
|
||||
@Setter protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
|
||||
|
||||
@@ -72,6 +72,8 @@ import io.swagger.v3.oas.models.info.License;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
|
||||
public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
@@ -300,6 +302,7 @@ public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
@Nullable
|
||||
HTTPBody body;
|
||||
boolean hasBodyExample;
|
||||
boolean hasCookie;
|
||||
@Nullable
|
||||
HTTPParameters params;
|
||||
@Nullable
|
||||
@@ -308,7 +311,7 @@ public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
DataExtractSubstituteParameter dataExtract;
|
||||
|
||||
public HTTPRequest(String operationId, String method, String path, @Nullable List<Parameter> query, @Nullable HTTPBody body,
|
||||
boolean hasBodyExample, @Nullable HTTPParameters params, @Nullable List<k6Check> k6Checks,
|
||||
boolean hasBodyExample, boolean hasCookie, @Nullable HTTPParameters params, @Nullable List<k6Check> k6Checks,
|
||||
DataExtractSubstituteParameter dataExtract) {
|
||||
// NOTE: https://k6.io/docs/javascript-api/k6-http/del-url-body-params
|
||||
this.method = method.equals("delete") ? "del" : method;
|
||||
@@ -318,6 +321,7 @@ public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
this.query = query;
|
||||
this.body = body;
|
||||
this.hasBodyExample = hasBodyExample;
|
||||
this.hasCookie = hasCookie;
|
||||
this.params = params;
|
||||
this.k6Checks = k6Checks;
|
||||
this.dataExtract = dataExtract;
|
||||
@@ -494,6 +498,29 @@ public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
Set<Parameter> extraParameters = new HashSet<>();
|
||||
Map<String, Set<Parameter>> pathVariables = new HashMap<>();
|
||||
|
||||
// get security schema from components
|
||||
Map<String, SecurityScheme> securitySchemeMap = openAPI != null ?
|
||||
(openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null) : null;
|
||||
|
||||
// get global security requirements
|
||||
List<SecurityRequirement> securityRequirements = openAPI.getSecurity();
|
||||
|
||||
// match global security requirements with security schemes and transform them to global auth methods
|
||||
// global auth methods is a list of auth methods that are used in all requests
|
||||
List<CodegenSecurity> globalAuthMethods = new ArrayList<>();
|
||||
Map<String, SecurityScheme> globalSecurityMap = new HashMap<>();
|
||||
if (securityRequirements != null) {
|
||||
for (SecurityRequirement securityRequirement : securityRequirements) {
|
||||
for (String securityRequirementKey : securityRequirement.keySet()) {
|
||||
SecurityScheme securityScheme = securitySchemeMap.get(securityRequirementKey);
|
||||
if (securityScheme != null) {
|
||||
globalSecurityMap.put(securityRequirementKey, securityScheme);
|
||||
}
|
||||
}
|
||||
}
|
||||
globalAuthMethods = fromSecurity(globalSecurityMap);
|
||||
}
|
||||
|
||||
for (String path : openAPI.getPaths().keySet()) {
|
||||
Map<Integer, HTTPRequest> requests = new HashMap<>();
|
||||
Set<Parameter> variables = new HashSet<>();
|
||||
@@ -503,6 +530,7 @@ public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
for (Map.Entry<PathItem.HttpMethod, Operation> methodOperation : openAPI.getPaths().get(path).
|
||||
readOperationsMap().entrySet()) {
|
||||
List<Parameter> httpParams = new ArrayList<>();
|
||||
List<Parameter> cookieParams = new ArrayList<>();
|
||||
List<Parameter> queryParams = new ArrayList<>();
|
||||
List<Parameter> bodyOrFormParams = new ArrayList<>();
|
||||
List<k6Check> k6Checks = new ArrayList<>();
|
||||
@@ -638,7 +666,19 @@ public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
pathVariables.put(groupName, variables);
|
||||
|
||||
final HTTPParameters params = new HTTPParameters(null, null, httpParams, null, null, null, null, null,
|
||||
// put auth medthods in header or cookie
|
||||
for (CodegenSecurity globalAuthMethod : globalAuthMethods) {
|
||||
if (globalAuthMethod.isKeyInHeader) {
|
||||
httpParams.add(new Parameter(globalAuthMethod.keyParamName, getTemplateString(toVarName(globalAuthMethod.keyParamName))));
|
||||
extraParameters.add(new Parameter(toVarName(globalAuthMethod.keyParamName), globalAuthMethod.keyParamName.toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
if (globalAuthMethod.isKeyInCookie) {
|
||||
cookieParams.add(new Parameter(globalAuthMethod.keyParamName, getTemplateString(toVarName(globalAuthMethod.keyParamName))));
|
||||
extraParameters.add(new Parameter(toVarName(globalAuthMethod.keyParamName), globalAuthMethod.keyParamName.toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
}
|
||||
|
||||
final HTTPParameters params = new HTTPParameters(null, cookieParams, httpParams, null, null, null, null, null,
|
||||
responseType.length() > 0 ? responseType : null);
|
||||
|
||||
assert params.headers != null;
|
||||
@@ -650,11 +690,18 @@ public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
// calculate order for this current request
|
||||
Integer requestOrder = calculateRequestOrder(operationGroupingOrder, requests.size());
|
||||
|
||||
requests.put(requestOrder, new HTTPRequest(operationId, method.toString().toLowerCase(Locale.ROOT), path,
|
||||
queryParams.size() > 0 ? queryParams : null,
|
||||
bodyOrFormParams.size() > 0 ? new HTTPBody(bodyOrFormParams) : null, hasRequestBodyExample,
|
||||
params.headers.size() > 0 ? params : null, k6Checks.size() > 0 ? k6Checks : null,
|
||||
dataExtract.orElse(null)));
|
||||
requests.put(requestOrder, new HTTPRequest(
|
||||
operationId,
|
||||
method.toString().toLowerCase(Locale.ROOT),
|
||||
path,
|
||||
queryParams.size() > 0 ? queryParams : null,
|
||||
bodyOrFormParams.size() > 0 ? new HTTPBody(bodyOrFormParams) : null,
|
||||
hasRequestBodyExample,
|
||||
params.cookies.size() > 0 ? true : false,
|
||||
params.headers.size() > 0 ? params : null,
|
||||
k6Checks.size() > 0 ? k6Checks : null,
|
||||
dataExtract.orElse(null))
|
||||
);
|
||||
}
|
||||
|
||||
addOrUpdateRequestGroup(requestGroups, groupName, pathVariables.get(groupName), requests);
|
||||
|
||||
@@ -331,7 +331,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
* Sets the serialization engine for Kotlin
|
||||
*
|
||||
* @param enumSerializationLibrary The string representation of the serialization library as defined by
|
||||
* {@link org.openapitools.codegen.languages.AbstractKotlinCodegen.SERIALIZATION_LIBRARY_TYPE}
|
||||
* {@link org.openapitools.codegen.languages.KotlinClientCodegen.SERIALIZATION_LIBRARY_TYPE}
|
||||
*/
|
||||
public void setSerializationLibrary(final String enumSerializationLibrary) {
|
||||
try {
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenResponse;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.VendorExtension;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
import org.openapitools.codegen.languages.features.DocumentationProviderFeatures;
|
||||
import org.openapitools.codegen.languages.features.SwaggerUIFeatures;
|
||||
@@ -93,6 +94,8 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
public static final String SERVICE_INTERFACE = "serviceInterface";
|
||||
public static final String SERVICE_IMPLEMENTATION = "serviceImplementation";
|
||||
public static final String SKIP_DEFAULT_INTERFACE = "skipDefaultInterface";
|
||||
public static final String SKIP_DEFAULT_API_INTERFACE = "skipDefaultApiInterface";
|
||||
public static final String SKIP_DEFAULT_DELEGATE_INTERFACE = "skipDefaultDelegateInterface";
|
||||
public static final String REACTIVE = "reactive";
|
||||
public static final String INTERFACE_ONLY = "interfaceOnly";
|
||||
public static final String USE_FEIGN_CLIENT_URL = "useFeignClientUrl";
|
||||
@@ -134,6 +137,8 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
private String title = "OpenAPI Kotlin Spring";
|
||||
private boolean useBeanValidation = true;
|
||||
@Setter private boolean skipDefaultInterface = false;
|
||||
@Setter private boolean skipDefaultApiInterface = false;
|
||||
@Setter private boolean skipDefaultDelegateInterface = false;
|
||||
@Setter private boolean exceptionHandler = true;
|
||||
@Setter private boolean gradleBuildFile = true;
|
||||
private boolean useSwaggerUI = true;
|
||||
@@ -221,7 +226,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
addSwitch(SERVICE_IMPLEMENTATION, "generate stub service implementations that extends service " +
|
||||
"interfaces. If this is set to true service interfaces will also be generated", serviceImplementation);
|
||||
addSwitch(USE_BEANVALIDATION, "Use BeanValidation API annotations to validate data types", useBeanValidation);
|
||||
addSwitch(SKIP_DEFAULT_INTERFACE, "Whether to skip generation of default implementations for interfaces", skipDefaultInterface);
|
||||
addSwitch(SKIP_DEFAULT_INTERFACE, "Whether to skip generation of default implementations for interfaces (Api interfaces or Delegate interfaces depending on the delegatePattern option)", skipDefaultInterface);
|
||||
addSwitch(REACTIVE, "use coroutines for reactive behavior", reactive);
|
||||
addSwitch(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.", interfaceOnly);
|
||||
addSwitch(USE_FEIGN_CLIENT_URL, "Whether to generate Feign client with url parameter.", useFeignClientUrl);
|
||||
@@ -561,6 +566,16 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
this.setDelegatePattern(Boolean.parseBoolean(additionalProperties.get(DELEGATE_PATTERN).toString()));
|
||||
}
|
||||
|
||||
if (skipDefaultInterface) {
|
||||
if (delegatePattern) {
|
||||
this.setSkipDefaultDelegateInterface(true);
|
||||
} else {
|
||||
this.setSkipDefaultApiInterface(true);
|
||||
}
|
||||
}
|
||||
writePropertyBack(SKIP_DEFAULT_API_INTERFACE, skipDefaultApiInterface);
|
||||
writePropertyBack(SKIP_DEFAULT_DELEGATE_INTERFACE, skipDefaultDelegateInterface);
|
||||
|
||||
if (additionalProperties.containsKey(USE_TAGS)) {
|
||||
this.setUseTags(Boolean.parseBoolean(additionalProperties.get(USE_TAGS).toString()));
|
||||
}
|
||||
@@ -800,6 +815,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
model.imports.add("JsonProperty");
|
||||
if (Boolean.TRUE.equals(model.hasEnums)) {
|
||||
model.imports.add("JsonValue");
|
||||
model.imports.add("JsonCreator");
|
||||
}
|
||||
} else {
|
||||
//Needed imports for Jackson's JsonCreator
|
||||
@@ -825,10 +841,14 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
.filter(cm -> Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null)
|
||||
.forEach(cm -> {
|
||||
cm.imports.add(importMapping.get("JsonValue"));
|
||||
cm.imports.add(importMapping.get("JsonCreator"));
|
||||
cm.imports.add(importMapping.get("JsonProperty"));
|
||||
Map<String, String> itemJsonValue = new HashMap<>();
|
||||
itemJsonValue.put("import", importMapping.get("JsonValue"));
|
||||
imports.add(itemJsonValue);
|
||||
Map<String, String> itemJsonCreator = new HashMap<>();
|
||||
itemJsonCreator.put("import", importMapping.get("JsonCreator"));
|
||||
imports.add(itemJsonCreator);
|
||||
Map<String, String> itemJsonProperty = new HashMap<>();
|
||||
itemJsonProperty.put("import", importMapping.get("JsonProperty"));
|
||||
imports.add(itemJsonProperty);
|
||||
@@ -874,7 +894,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
final List<CodegenParameter> allParams = operation.allParams;
|
||||
if (allParams != null) {
|
||||
if (this.isAppendRequestToHandler()) {
|
||||
allParams.add(new RequestCodegenParameter(true));
|
||||
allParams.add(new RequestCodegenParameter());
|
||||
}
|
||||
allParams.forEach(param ->
|
||||
// This is necessary in case 'modelMutable' is enabled,
|
||||
@@ -971,7 +991,16 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
static class RequestCodegenParameter extends CodegenParameter {
|
||||
boolean isRequestObject;
|
||||
|
||||
boolean isRequestObject = true;
|
||||
|
||||
public RequestCodegenParameter() {
|
||||
this.isOptional = false;
|
||||
this.required = true;
|
||||
this.paramName = "serverHttpRequest";
|
||||
this.dataType = "ServerHttpRequest";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public RequestMappingMode getRequestMappingMode() {
|
||||
@@ -982,4 +1011,16 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
this.requestMappingMode = requestMappingMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VendorExtension> getSupportedVendorExtensions() {
|
||||
List<VendorExtension> extensions = super.getSupportedVendorExtensions();
|
||||
extensions.add(VendorExtension.X_ACCEPTS);
|
||||
extensions.add(VendorExtension.X_CLASS_EXTRA_ANNOTATION);
|
||||
extensions.add(VendorExtension.X_CONTENT_TYPE);
|
||||
extensions.add(VendorExtension.X_DISCRIMINATOR_VALUE);
|
||||
extensions.add(VendorExtension.X_FIELD_EXTRA_ANNOTATION);
|
||||
extensions.add(VendorExtension.X_PATTERN_MESSAGE);
|
||||
return extensions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,11 +62,8 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
));
|
||||
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Returns default database name for all MySQL queries
|
||||
* This value must be used with backticks only, eg. `database_name`
|
||||
*
|
||||
* @return default database name
|
||||
* This value must be used with backticks only, e.g. `database_name`
|
||||
*/
|
||||
@Getter protected String defaultDatabaseName = "", databaseNamePrefix = "", databaseNameSuffix = "_db";
|
||||
protected String tableNamePrefix = "tbl_", tableNameSuffix = "";
|
||||
@@ -83,10 +80,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
@Getter @Setter
|
||||
protected Boolean namedParametersEnabled = false;
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Returns identifier naming convention for table names and column names.
|
||||
*
|
||||
* @return identifier naming convention
|
||||
*/
|
||||
@Getter protected String identifierNamingConvention = "original";
|
||||
|
||||
|
||||
@@ -54,10 +54,7 @@ public class PhpSlim4ServerCodegen extends AbstractPhpCodegen {
|
||||
protected String appDirName = "App";
|
||||
protected String appPackage = "";
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Returns PSR-7 implementation package.
|
||||
*
|
||||
* @return PSR-7 implementation package
|
||||
*/
|
||||
@Getter protected String psr7Implementation = "slim-psr7";
|
||||
protected String interfacesDirName = "Interfaces";
|
||||
|
||||
@@ -57,6 +57,7 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
public static final String PACKAGE_NAME = "packageName";
|
||||
public static final String PACKAGE_VERSION = "packageVersion";
|
||||
public static final String HYPER_LIBRARY = "hyper";
|
||||
public static final String HYPER0X_LIBRARY = "hyper0x";
|
||||
public static final String REQWEST_LIBRARY = "reqwest";
|
||||
public static final String SUPPORT_ASYNC = "supportAsync";
|
||||
public static final String SUPPORT_MIDDLEWARE = "supportMiddleware";
|
||||
@@ -202,7 +203,8 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
cliOptions.add(new CliOption(AVOID_BOXED_MODELS, "If set, `Box<T>` will not be used for models", SchemaTypeUtil.BOOLEAN_TYPE)
|
||||
.defaultValue(Boolean.FALSE.toString()));
|
||||
|
||||
supportedLibraries.put(HYPER_LIBRARY, "HTTP client: Hyper.");
|
||||
supportedLibraries.put(HYPER_LIBRARY, "HTTP client: Hyper (v1.x).");
|
||||
supportedLibraries.put(HYPER0X_LIBRARY, "HTTP client: Hyper (v0.x).");
|
||||
supportedLibraries.put(REQWEST_LIBRARY, "HTTP client: Reqwest.");
|
||||
|
||||
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use.");
|
||||
@@ -371,6 +373,9 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
|
||||
if (HYPER_LIBRARY.equals(getLibrary())) {
|
||||
additionalProperties.put(HYPER_LIBRARY, "true");
|
||||
} else if (HYPER0X_LIBRARY.equals(getLibrary())) {
|
||||
additionalProperties.put(HYPER_LIBRARY, "true");
|
||||
additionalProperties.put(HYPER0X_LIBRARY, "true");
|
||||
} else if (REQWEST_LIBRARY.equals(getLibrary())) {
|
||||
additionalProperties.put(REQWEST_LIBRARY, "true");
|
||||
} else {
|
||||
|
||||
@@ -294,7 +294,9 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
||||
|
||||
// Set the typescript version compatible to the Angular version
|
||||
// based on https://angular.io/guide/versions#actively-supported-versions
|
||||
if (ngVersion.atLeast("18.0.0")) {
|
||||
if (ngVersion.atLeast("18.1.0")) {
|
||||
additionalProperties.put("tsVersion", ">=5.4.0 <5.6.0");
|
||||
} else if (ngVersion.atLeast("18.0.0")) {
|
||||
additionalProperties.put("tsVersion", ">=5.4.0 <5.5.0");
|
||||
} else if (ngVersion.atLeast("17.0.0")) {
|
||||
additionalProperties.put("tsVersion", ">=4.9.3 <5.3.0");
|
||||
@@ -342,7 +344,11 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
||||
supportingFiles.add(new SupportingFile("ng-package.mustache", getIndexDirectory(), "ng-package.json"));
|
||||
|
||||
// Specific ng-packagr configuration
|
||||
if (ngVersion.atLeast("18.0.0")) {
|
||||
if (ngVersion.atLeast("18.1.0")) {
|
||||
additionalProperties.put("ngPackagrVersion", "18.1.0");
|
||||
// tsTickle is not required and there is no available version compatible with
|
||||
// versions of TypeScript compatible with Angular 18.
|
||||
} else if (ngVersion.atLeast("18.0.0")) {
|
||||
additionalProperties.put("ngPackagrVersion", "18.0.0");
|
||||
// tsTickle is not required and there is no available version compatible with
|
||||
// versions of TypeScript compatible with Angular 18.
|
||||
|
||||
@@ -44,11 +44,16 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
public static final String STRING_ENUMS = "stringEnums";
|
||||
public static final String STRING_ENUMS_DESC = "Generate string enums instead of objects for enum values.";
|
||||
public static final String USE_SQUARE_BRACKETS_IN_ARRAY_NAMES = "useSquareBracketsInArrayNames";
|
||||
public static final String AXIOS_VERSION = "axiosVersion";
|
||||
public static final String DEFAULT_AXIOS_VERSION = "^1.6.1";
|
||||
|
||||
@Getter @Setter
|
||||
protected String npmRepository = null;
|
||||
protected Boolean stringEnums = false;
|
||||
|
||||
@Getter @Setter
|
||||
protected String axiosVersion = DEFAULT_AXIOS_VERSION;
|
||||
|
||||
private String tsModelPackage = "";
|
||||
|
||||
public TypeScriptAxiosClientCodegen() {
|
||||
@@ -77,6 +82,7 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
this.cliOptions.add(new CliOption(WITH_NODE_IMPORTS, "Setting this property to true adds imports for NodeJS", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(STRING_ENUMS, STRING_ENUMS_DESC).defaultValue(String.valueOf(this.stringEnums)));
|
||||
this.cliOptions.add(new CliOption(USE_SQUARE_BRACKETS_IN_ARRAY_NAMES, "Setting this property to true will add brackets to array attribute names, e.g. my_values[].", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(AXIOS_VERSION, "Use this property to override the axios version in package.json").defaultValue(DEFAULT_AXIOS_VERSION));
|
||||
// Templates have no mapping between formatted property names and original base names so use only "original" and remove this option
|
||||
removeOption(CodegenConstants.MODEL_PROPERTY_NAMING);
|
||||
}
|
||||
@@ -148,6 +154,11 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
addNpmPackageGeneration();
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(AXIOS_VERSION)) {
|
||||
setAxiosVersion(additionalProperties.get(AXIOS_VERSION).toString());
|
||||
}
|
||||
additionalProperties.put("axiosVersion", getAxiosVersion());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -75,6 +75,9 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
|
||||
|
||||
private static final String USE_OBJECT_PARAMS_SWITCH = "useObjectParameters";
|
||||
private static final String USE_OBJECT_PARAMS_DESC = "Use aggregate parameter objects as function arguments for api operations instead of passing each parameter as a separate function argument.";
|
||||
private static final String ENUM_TYPE_SWITCH = "enumType";
|
||||
private static final String ENUM_TYPE_SWITCH_DESC = "Specify the enum type which should be used in the client code.";
|
||||
private static final String[][] ENUM_TYPES = {{"stringUnion", "Union of literal string types"}, {"enum", "Typescript's [string enums](https://www.typescriptlang.org/docs/handbook/enums.html#string-enums)"}};
|
||||
|
||||
private final Map<String, String> frameworkToHttpLibMap;
|
||||
|
||||
@@ -137,6 +140,13 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
|
||||
|
||||
cliOptions.add(platformOption);
|
||||
|
||||
CliOption enumTypeOption = new CliOption(TypeScriptClientCodegen.ENUM_TYPE_SWITCH, TypeScriptClientCodegen.ENUM_TYPE_SWITCH_DESC);
|
||||
for (String[] option : TypeScriptClientCodegen.ENUM_TYPES) {
|
||||
enumTypeOption.addEnum(option[0], option[1]);
|
||||
}
|
||||
enumTypeOption.defaultValue(ENUM_TYPES[1][0]);
|
||||
cliOptions.add(enumTypeOption);
|
||||
|
||||
// Set property naming to camelCase
|
||||
supportModelPropertyNaming(CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.camelCase);
|
||||
|
||||
@@ -404,6 +414,15 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
|
||||
"http", httpLibName + ".ts"
|
||||
));
|
||||
|
||||
additionalProperties.putIfAbsent(ENUM_TYPE_SWITCH, ENUM_TYPES[1][0]);
|
||||
Object propEnumType = additionalProperties.get(ENUM_TYPE_SWITCH);
|
||||
|
||||
Map<String, Boolean> enumTypes = new HashMap<>();
|
||||
for (String[] option : ENUM_TYPES) {
|
||||
enumTypes.put(option[0], option[0].equals(propEnumType));
|
||||
}
|
||||
additionalProperties.put("enumTypes", enumTypes);
|
||||
|
||||
Object propPlatform = additionalProperties.get(PLATFORM_SWITCH);
|
||||
if (propPlatform == null) {
|
||||
propPlatform = "browser";
|
||||
@@ -458,12 +477,8 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(Schema p) {
|
||||
Schema inner;
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
inner = ModelUtils.getSchemaItems(p);
|
||||
return this.getSchemaType(p) + "<" + this.getTypeDeclaration(unaliasSchema(inner)) + ">";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
inner = getSchemaAdditionalProperties(p);
|
||||
if (ModelUtils.isMapSchema(p)) {
|
||||
Schema<?> inner = getSchemaAdditionalProperties(p);
|
||||
String postfix = "";
|
||||
if (Boolean.TRUE.equals(inner.getNullable())) {
|
||||
postfix = " | null";
|
||||
|
||||
@@ -41,6 +41,7 @@ import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Objects.nonNull;
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
@@ -387,8 +388,32 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
for (ModelsMap entry : result.values()) {
|
||||
for (ModelMap model : entry.getModels()) {
|
||||
ExtendedCodegenModel codegenModel = (ExtendedCodegenModel) model.getModel();
|
||||
model.put("hasImports", codegenModel.imports.size() > 0);
|
||||
boolean importsPresent = !codegenModel.imports.isEmpty();
|
||||
|
||||
// When legacyDiscriminatorBehaviour = false, DefaultCodegen will add the mapped models of the
|
||||
// discriminator to codegenModel.imports, causing us to duplicate the import if we don't remove them
|
||||
CodegenDiscriminator discriminator = codegenModel.discriminator;
|
||||
boolean mappedDiscriminatorModelsPresent = nonNull(discriminator)
|
||||
&& nonNull(discriminator.getMappedModels());
|
||||
if (importsPresent && mappedDiscriminatorModelsPresent) {
|
||||
Set<String> mappedDiscriminatorModelNames = discriminator.getMappedModels()
|
||||
.stream()
|
||||
.map(CodegenDiscriminator.MappedModel::getModelName)
|
||||
.collect(Collectors.toSet());
|
||||
Set<String> filteredImports = codegenModel.imports
|
||||
.stream()
|
||||
.filter(modelImport ->
|
||||
!mappedDiscriminatorModelNames.contains(modelImport))
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
codegenModel.imports.clear();
|
||||
codegenModel.imports.addAll(filteredImports);
|
||||
}
|
||||
|
||||
model.put("hasImports", importsPresent);
|
||||
model.put("tsImports", toTsImports(codegenModel, parseImports(codegenModel)));
|
||||
|
||||
|
||||
allModels.add(codegenModel);
|
||||
if (codegenModel.isEntity) {
|
||||
entityModelClassnames.add(codegenModel.classname);
|
||||
@@ -804,10 +829,6 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
newItemsDataType = "string";
|
||||
var.dataTypeAlternate = var.dataTypeAlternate.replace("number", newItemsDataType);
|
||||
}
|
||||
|
||||
if (var.itemsAreNullable()) {
|
||||
var.dataTypeAlternate = var.dataTypeAlternate.replace(newItemsDataType, newItemsDataType + " | null");
|
||||
}
|
||||
} else if (var.isEnum) {
|
||||
var.dataTypeAlternate = var.datatypeWithEnum;
|
||||
} else if (var.isModel) {
|
||||
@@ -825,10 +846,6 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
return parentIsEntity;
|
||||
}
|
||||
|
||||
private boolean itemsAreNullable(ExtendedCodegenProperty var) {
|
||||
return var.items.isNullable || (var.items.items != null && var.items.items.isNullable);
|
||||
}
|
||||
|
||||
private void escapeOperationIds(OperationsMap operations) {
|
||||
for (CodegenOperation _op : operations.getOperations().getOperation()) {
|
||||
ExtendedCodegenOperation op = (ExtendedCodegenOperation) _op;
|
||||
@@ -925,10 +942,6 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
newItemsDataType = "string";
|
||||
param.dataTypeAlternate = param.dataTypeAlternate.replace("number", newItemsDataType);
|
||||
}
|
||||
|
||||
if (param.itemsAreNullable()) {
|
||||
param.dataTypeAlternate = param.dataTypeAlternate.replace(newItemsDataType, newItemsDataType + " | null");
|
||||
}
|
||||
} else if (param.isEnum) {
|
||||
param.dataTypeAlternate = param.datatypeWithEnum;
|
||||
} else if (param.isModel) {
|
||||
@@ -1022,16 +1035,6 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean itemsAreNullable(CodegenProperty items) {
|
||||
if (items == null) {
|
||||
return true;
|
||||
}
|
||||
if (items.items != null) {
|
||||
return itemsAreNullable(items.items);
|
||||
}
|
||||
return items.isNullable;
|
||||
}
|
||||
|
||||
private static String getItemsDataType(CodegenProperty items) {
|
||||
if (items == null) {
|
||||
return null;
|
||||
@@ -1042,7 +1045,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
return items.dataType;
|
||||
}
|
||||
|
||||
class ExtendedCodegenParameter extends CodegenParameter {
|
||||
public class ExtendedCodegenParameter extends CodegenParameter {
|
||||
public String dataTypeAlternate;
|
||||
public boolean isUniqueId; // this parameter represents a unique id (x-isUniqueId: true)
|
||||
public List<CodegenProperty> readOnlyVars; // a list of read-only properties
|
||||
@@ -1052,10 +1055,6 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
return TypeScriptFetchClientCodegen.itemsAreUniqueId(this.items);
|
||||
}
|
||||
|
||||
public boolean itemsAreNullable() {
|
||||
return TypeScriptFetchClientCodegen.itemsAreNullable(this.items);
|
||||
}
|
||||
|
||||
public String getItemsDataType() {
|
||||
return TypeScriptFetchClientCodegen.getItemsDataType(this.items);
|
||||
}
|
||||
@@ -1120,6 +1119,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
this.isMap = cp.isMap;
|
||||
this.isFile = cp.isFile;
|
||||
this.isEnum = cp.isEnum;
|
||||
this.isEnumRef = cp.isEnumRef;
|
||||
this._enum = cp._enum;
|
||||
this.allowableValues = cp.allowableValues;
|
||||
this.items = cp.items;
|
||||
@@ -1194,7 +1194,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
}
|
||||
}
|
||||
|
||||
class ExtendedCodegenProperty extends CodegenProperty {
|
||||
public class ExtendedCodegenProperty extends CodegenProperty {
|
||||
public String dataTypeAlternate;
|
||||
public boolean isEntity; //Is a model containing an "id" property marked as isUniqueId and which matches the 'x-entityId' value.
|
||||
public boolean isUniqueId; // The property represents a unique id (x-isUniqueId: true)
|
||||
@@ -1205,10 +1205,6 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
return TypeScriptFetchClientCodegen.itemsAreUniqueId(this.items);
|
||||
}
|
||||
|
||||
public boolean itemsAreNullable() {
|
||||
return TypeScriptFetchClientCodegen.itemsAreNullable(this.items);
|
||||
}
|
||||
|
||||
public String getItemsDataType() {
|
||||
return TypeScriptFetchClientCodegen.getItemsDataType(this.items);
|
||||
}
|
||||
@@ -1280,6 +1276,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
this.isArray = cp.isArray;
|
||||
this.isMap = cp.isMap;
|
||||
this.isEnum = cp.isEnum;
|
||||
this.isEnumRef = cp.isEnumRef;
|
||||
this.isReadOnly = cp.isReadOnly;
|
||||
this.isWriteOnly = cp.isWriteOnly;
|
||||
this.isNullable = cp.isNullable;
|
||||
@@ -1350,7 +1347,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
}
|
||||
}
|
||||
|
||||
class ExtendedCodegenOperation extends CodegenOperation {
|
||||
public class ExtendedCodegenOperation extends CodegenOperation {
|
||||
boolean hasReturnPassthroughVoid, returnTypeSupportsEntities, returnTypeIsModel, returnTypeIsArray;
|
||||
String returnTypeAlternate, returnBaseTypeAlternate, returnPassthrough;
|
||||
|
||||
@@ -1467,7 +1464,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
}
|
||||
}
|
||||
|
||||
class ExtendedCodegenModel extends CodegenModel {
|
||||
public class ExtendedCodegenModel extends CodegenModel {
|
||||
@Getter @Setter
|
||||
public Set<String> modelImports = new TreeSet<String>();
|
||||
public boolean isEntity; // Is a model containing an "id" property marked as isUniqueId
|
||||
|
||||
@@ -7,22 +7,16 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter public class TemplateManagerOptions {
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Determines whether the template should minimally update a target file.
|
||||
* A minimal update means the template manager is requested to update a file only if it is newer.
|
||||
* This option avoids "touching" a file and causing the last modification time (mtime) to change.
|
||||
*
|
||||
* @return true to prefer updating only changed files, false to disable that suggestion
|
||||
*/
|
||||
private final boolean minimalUpdate;
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Determines whether the template manager should avoid overwriting an existing file.
|
||||
* This differs from requesting
|
||||
* which evaluates contents, while this option only
|
||||
* This differs from requesting which evaluates contents, while this option only
|
||||
* evaluates whether the file exists.
|
||||
*
|
||||
* @return true to avoid overwriting existing files (where supported), false to disable that suggestion.
|
||||
*/
|
||||
private final boolean skipOverwrite;
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ package {{invokerPackage}};
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import {{javaxPackage}}.validation.ConstraintViolation;
|
||||
import {{javaxPackage}}.validation.ValidationException;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ValidationException;
|
||||
|
||||
public class BeanValidationException extends ValidationException {
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user