mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-09-05 05:13:44 +00:00
Compare commits
49 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3029ac62f7 | ||
|
27018b0a0d | ||
|
5544e6acc5 | ||
|
08733aaf25 | ||
|
3f24026b87 | ||
|
27ed27f135 | ||
|
3cc094485d | ||
|
86f107047e | ||
|
2ebda09b9f | ||
|
fde017150e | ||
|
5daef3e901 | ||
|
6e443f1354 | ||
|
babb3e272b | ||
|
d1df75c61d | ||
|
20d5126b17 | ||
|
efd06f5719 | ||
|
c854a23682 | ||
|
1c2fd67cc9 | ||
|
27d3c6f326 | ||
|
eae5088f7c | ||
|
90d6af2bab | ||
|
d8593ef6d7 | ||
|
9148db26fc | ||
|
2cdd9ae687 | ||
|
443fd76529 | ||
|
9c1b680fdf | ||
|
bd0b81d26d | ||
|
afedd3fd33 | ||
|
399547c2ba | ||
|
daa8eb422d | ||
|
e4c9eb36e9 | ||
|
ac5478e909 | ||
|
992e387e27 | ||
|
e903a89ccf | ||
|
ffaeca3204 | ||
|
7c4d7277b4 | ||
|
065eceb824 | ||
|
8ce639ddae | ||
|
ca7e8bd932 | ||
|
e1447bc3dc | ||
|
c134a8adbf | ||
|
9c11fcf6bc | ||
|
6215e6e005 | ||
|
814f406472 | ||
|
3d93cc05ec | ||
|
dc8fac21d9 | ||
|
cd7fe341d3 | ||
|
66c2a287cc | ||
|
20be2decde |
@ -26,7 +26,7 @@ jobs:
|
||||
- samples/server/petstore/aspnet/fastendpoints-useValidators
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v4.3.1
|
||||
- uses: actions/setup-dotnet@v5.0.0
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Build
|
||||
|
53
.github/workflows/samples-dart-build-test.yaml
vendored
Normal file
53
.github/workflows/samples-dart-build-test.yaml
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
name: Samples Dart (build, test)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
paths:
|
||||
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/**
|
||||
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/**
|
||||
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/**
|
||||
- samples/openapi3/client/petstore/dart-dio/oneof/**
|
||||
- samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/**
|
||||
- samples/openapi3/client/petstore/dart-dio/binary_response/**
|
||||
pull_request:
|
||||
paths:
|
||||
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/**
|
||||
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/**
|
||||
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/**
|
||||
- samples/openapi3/client/petstore/dart-dio/oneof/**
|
||||
- samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/**
|
||||
- samples/openapi3/client/petstore/dart-dio/binary_response/**
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
sdk: ["3.9.0"]
|
||||
sample:
|
||||
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/
|
||||
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/
|
||||
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/
|
||||
- samples/openapi3/client/petstore/dart-dio/oneof/
|
||||
- samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/
|
||||
- samples/openapi3/client/petstore/dart-dio/binary_response/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- uses: dart-lang/setup-dart@v1
|
||||
with:
|
||||
sdk: ${{ matrix.sdk }}
|
||||
|
||||
- name: pub get
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: dart pub get
|
||||
|
||||
- name: build_runner build
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: dart run build_runner build
|
||||
|
||||
- name: test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: dart test
|
@ -28,7 +28,7 @@ jobs:
|
||||
# - samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v4.3.1
|
||||
- uses: actions/setup-dotnet@v5.0.0
|
||||
with:
|
||||
dotnet-version: 3.1.*
|
||||
- name: Build
|
||||
|
@ -25,7 +25,7 @@ jobs:
|
||||
- samples/server/petstore/aspnetcore-6.0-useSwashBuckle
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v4.3.1
|
||||
- uses: actions/setup-dotnet@v5.0.0
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
- name: Build
|
||||
|
@ -19,7 +19,7 @@ jobs:
|
||||
- samples/client/echo_api/csharp/restsharp/net8/EchoApi
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v4.3.1
|
||||
- uses: actions/setup-dotnet@v5.0.0
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Run echo server
|
||||
|
@ -19,7 +19,7 @@ jobs:
|
||||
- samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v4.3.1
|
||||
- uses: actions/setup-dotnet@v5.0.0
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Build
|
||||
|
@ -26,7 +26,7 @@ jobs:
|
||||
- samples/server/petstore/aspnetcore-8.0-use-centralized-package-version-management
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v4.3.1
|
||||
- uses: actions/setup-dotnet@v5.0.0
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Build
|
||||
|
2
.github/workflows/samples-dotnet8.yaml
vendored
2
.github/workflows/samples-dotnet8.yaml
vendored
@ -34,7 +34,7 @@ jobs:
|
||||
- samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v4.3.1
|
||||
- uses: actions/setup-dotnet@v5.0.0
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Build
|
||||
|
2
.github/workflows/samples-dotnet9.yaml
vendored
2
.github/workflows/samples-dotnet9.yaml
vendored
@ -47,7 +47,7 @@ jobs:
|
||||
#- samples/client/petstore/csharp/unityWebRequest/net9/Petstore
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v4.3.1
|
||||
- uses: actions/setup-dotnet@v5.0.0
|
||||
with:
|
||||
dotnet-version: '9.0.101'
|
||||
- name: Build
|
||||
|
@ -17,11 +17,11 @@ jobs:
|
||||
- samples/client/echo_api/go
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-go@v5
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: "stable"
|
||||
- name: Setup node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
- name: Run echo server
|
||||
run: |
|
||||
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
|
||||
|
2
.github/workflows/samples-go-client.yaml
vendored
2
.github/workflows/samples-go-client.yaml
vendored
@ -19,7 +19,7 @@ jobs:
|
||||
- 'samples/openapi3/client/petstore/go/go-petstore-aws-signature/'
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-go@v5
|
||||
- uses: actions/setup-go@v6
|
||||
- run: go version
|
||||
- name: Install Dependencies
|
||||
working-directory: ${{ matrix.sample }}
|
||||
|
2
.github/workflows/samples-go-gin.yaml
vendored
2
.github/workflows/samples-go-gin.yaml
vendored
@ -22,7 +22,7 @@ jobs:
|
||||
- samples/server/petstore/go-gin-api-server-interface-only/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-go@v5
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: "stable"
|
||||
- run: go version
|
||||
|
4
.github/workflows/samples-go.yaml
vendored
4
.github/workflows/samples-go.yaml
vendored
@ -28,7 +28,7 @@ jobs:
|
||||
- samples/server/others/go-server/no-body-path-params/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-go@v5
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: "stable"
|
||||
- run: go version
|
||||
@ -49,7 +49,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Install Dependencies
|
||||
|
@ -36,7 +36,7 @@ jobs:
|
||||
~/.m2
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
- name: Setup node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
- name: Run echo server
|
||||
run: |
|
||||
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
|
||||
|
@ -37,7 +37,7 @@ jobs:
|
||||
~/.m2
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
- name: Setup node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
- name: Run echo server
|
||||
run: |
|
||||
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
|
||||
|
@ -43,7 +43,7 @@ jobs:
|
||||
~/.m2
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
- name: Setup node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
- name: Run echo server
|
||||
run: |
|
||||
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
|
||||
|
3
.github/workflows/samples-kotlin-client.yaml
vendored
3
.github/workflows/samples-kotlin-client.yaml
vendored
@ -33,6 +33,7 @@ jobs:
|
||||
- samples/client/petstore/kotlin-moshi-codegen
|
||||
- samples/client/petstore/kotlin-multiplatform
|
||||
- samples/client/petstore/kotlin-multiplatform-kotlinx-datetime
|
||||
- samples/client/petstore/kotlin-multiplatform-allOf-discriminator
|
||||
- samples/client/petstore/kotlin-nonpublic
|
||||
- samples/client/petstore/kotlin-nullable
|
||||
- samples/client/petstore/kotlin-retrofit2
|
||||
@ -69,7 +70,7 @@ jobs:
|
||||
- samples/client/others/kotlin-jvm-okhttp-parameter-tests
|
||||
- samples/client/others/kotlin-jvm-okhttp-path-comments
|
||||
- samples/client/others/kotlin-integer-enum
|
||||
- samples/client/petstore/kotlin-allOff-discriminator-kotlinx-serialization
|
||||
- samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-java@v5
|
||||
|
@ -40,7 +40,7 @@ jobs:
|
||||
build-root-directory: ${{ matrix.sample }}
|
||||
arguments: wrapper
|
||||
- name: Setup node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
- name: Run echo server
|
||||
run: |
|
||||
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
|
||||
|
9
.github/workflows/samples-ocaml.yaml
vendored
9
.github/workflows/samples-ocaml.yaml
vendored
@ -4,9 +4,15 @@ on:
|
||||
push:
|
||||
paths:
|
||||
- 'samples/client/petstore/ocaml/**'
|
||||
- 'samples/client/petstore/ocaml-fake-petstore/**'
|
||||
- 'samples/client/petstore/ocaml-oneOf-primitive/**'
|
||||
- 'samples/client/petstore/ocaml-additional-properties/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'samples/client/petstore/ocaml/**'
|
||||
- 'samples/client/petstore/ocaml-fake-petstore/**'
|
||||
- 'samples/client/petstore/ocaml-oneOf-primitive/**'
|
||||
- 'samples/client/petstore/ocaml-additional-properties/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -17,6 +23,9 @@ jobs:
|
||||
matrix:
|
||||
sample:
|
||||
- 'samples/client/petstore/ocaml/'
|
||||
- 'samples/client/petstore/ocaml-fake-petstore/'
|
||||
- 'samples/client/petstore/ocaml-oneOf-primitive/'
|
||||
- 'samples/client/petstore/ocaml-additional-properties/'
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Set-up OCaml
|
||||
|
48
.github/workflows/samples-php-server-syntax-check.yaml
vendored
Normal file
48
.github/workflows/samples-php-server-syntax-check.yaml
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
name: Samples PHP (Server) Syntax Checker
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- samples/server/petstore/php-symfony/SymfonyBundle-php/**
|
||||
#- samples/server/petstore/php-laravel/**
|
||||
- samples/server/petstore/php-flight/**
|
||||
- samples/server/petstore/php-mezzio-ph-modern/**
|
||||
- samples/server/petstore/php-mezzio-ph/**
|
||||
- samples/server/petstore/php-slim4/**
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/server/petstore/php-symfony/SymfonyBundle-php/**
|
||||
#- samples/server/petstore/php-laravel/**
|
||||
- samples/server/petstore/php-flight/**
|
||||
- samples/server/petstore/php-mezzio-ph-modern/**
|
||||
- samples/server/petstore/php-mezzio-ph/**
|
||||
- samples/server/petstore/php-slim4/**
|
||||
jobs:
|
||||
build:
|
||||
name: Build PHP projects
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php:
|
||||
- "8.1"
|
||||
- "8.2"
|
||||
- "8.3"
|
||||
- "8.4"
|
||||
sample:
|
||||
# servers
|
||||
- samples/server/petstore/php-symfony/SymfonyBundle-php/
|
||||
#- samples/server/petstore/php-laravel/
|
||||
- samples/server/petstore/php-flight/
|
||||
- samples/server/petstore/php-mezzio-ph-modern/
|
||||
- samples/server/petstore/php-mezzio-ph/
|
||||
- samples/server/petstore/php-slim4/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Setup PHP with tools
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "${{ matrix.php }}"
|
||||
- name: php -l
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: find . -name "*.php" -exec php -l {} +
|
2
.github/workflows/samples-postman.yaml
vendored
2
.github/workflows/samples-postman.yaml
vendored
@ -20,7 +20,7 @@ jobs:
|
||||
- "3.12"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install
|
||||
|
@ -25,11 +25,11 @@ jobs:
|
||||
- "3.13"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Setup node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
- name: Run echo server
|
||||
run: |
|
||||
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
|
||||
|
@ -19,7 +19,7 @@ jobs:
|
||||
- samples/server/petstore/python-fastapi/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.9'
|
||||
- name: Install dependencies
|
||||
|
@ -13,7 +13,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.13"
|
||||
- name: Install validator
|
||||
@ -45,7 +45,7 @@ jobs:
|
||||
SWAGGER_BASE_PATH: /v2
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: actions/setup-python@v6
|
||||
id: py
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
@ -24,11 +24,11 @@ jobs:
|
||||
- "3.12"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Setup node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
- name: Run echo server
|
||||
run: |
|
||||
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
|
||||
|
@ -32,7 +32,7 @@ jobs:
|
||||
SWAGGER_BASE_PATH: /v2
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: actions/setup-python@v6
|
||||
id: py
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
2
.github/workflows/samples-python-server.yaml
vendored
2
.github/workflows/samples-python-server.yaml
vendored
@ -19,7 +19,7 @@ jobs:
|
||||
- samples/server/petstore/python-aiohttp-srclayout/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.9'
|
||||
- name: Test
|
||||
|
2
.github/workflows/samples-ruby.yaml
vendored
2
.github/workflows/samples-ruby.yaml
vendored
@ -26,7 +26,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Setup node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
- name: Run echo server
|
||||
run: |
|
||||
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
|
||||
|
72
.github/workflows/samples-rust-client.yaml
vendored
Normal file
72
.github/workflows/samples-rust-client.yaml
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
name: Samples Rust Clients
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "samples/client/others/rust/**"
|
||||
- "samples/client/petstore/rust-server/**"
|
||||
pull_request:
|
||||
paths:
|
||||
- "samples/client/others/rust/**"
|
||||
- "samples/client/petstore/rust/**"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Rust
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
petstore-api:
|
||||
image: swaggerapi/petstore
|
||||
ports:
|
||||
- 80:8080
|
||||
env:
|
||||
SWAGGER_HOST: http://petstore.swagger.io
|
||||
SWAGGER_BASE_PATH: /v2
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
# these folders contain sub-projects of rust clients, servers
|
||||
- samples/client/others/rust/
|
||||
- samples/client/petstore/rust/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-targets: false # Don't cache workspace target directories as they don't exist
|
||||
cache-directories:
|
||||
${{ matrix.sample }}/target
|
||||
workspaces: |
|
||||
${{ matrix.sample }}/output/*
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: cargo build --all-targets --all-features
|
||||
- name: Tests
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: |
|
||||
set -e
|
||||
|
||||
# Iterate through each example and test various features
|
||||
for package in $(find . -maxdepth 1 -mindepth 1 -type d)
|
||||
do
|
||||
# Not all versions have a client example
|
||||
if test -f examples/client/main.rs; then
|
||||
cargo build --example client --features="client"
|
||||
fi
|
||||
|
||||
# Test the CLI works if present
|
||||
if test -f bin/cli.rs; then
|
||||
cargo build --bin ${package##*/} --features cli
|
||||
target/debug/${package##*/} --help
|
||||
fi
|
||||
cargo fmt
|
||||
cargo test
|
||||
cargo clippy
|
||||
cargo doc
|
||||
done
|
@ -1,16 +1,12 @@
|
||||
name: Samples Rust
|
||||
name: Samples Rust Servers
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "samples/client/others/rust/**"
|
||||
- "samples/server/petstore/rust-server/**"
|
||||
- "samples/client/petstore/rust-server/**"
|
||||
- "samples/server/petstore/rust-axum/**"
|
||||
pull_request:
|
||||
paths:
|
||||
- "samples/client/others/rust/**"
|
||||
- "samples/client/petstore/rust/**"
|
||||
- "samples/server/petstore/rust-server/**"
|
||||
- "samples/server/petstore/rust-axum/**"
|
||||
|
||||
@ -23,8 +19,6 @@ jobs:
|
||||
matrix:
|
||||
sample:
|
||||
# these folders contain sub-projects of rust clients, servers
|
||||
- samples/client/others/rust/
|
||||
- samples/client/petstore/rust/
|
||||
- samples/server/petstore/rust-server/
|
||||
- samples/server/petstore/rust-server-deprecated/
|
||||
- samples/server/petstore/rust-axum/
|
||||
@ -50,19 +44,10 @@ jobs:
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: |
|
||||
set -e
|
||||
# Skip samples/client/petstore/rust/ as its tests are failing.
|
||||
if [[ "${{ matrix.sample }}" == "samples/client/petstore/rust/" ]]; then
|
||||
echo "Skipping tests for samples/client/petstore/rust/"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Iterate through each example and test various features
|
||||
for package in $(find . -maxdepth 1 -mindepth 1 -type d)
|
||||
do
|
||||
# Not all versions have a client example
|
||||
if test -f examples/client/main.rs; then
|
||||
cargo build --example client --features="client"
|
||||
fi
|
||||
# Not all versions have a server example
|
||||
if test -f examples/server/main.rs; then
|
||||
cargo build --example server --features="server"
|
@ -22,7 +22,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
|
@ -22,7 +22,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
|
@ -21,7 +21,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
|
@ -22,7 +22,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
|
@ -18,7 +18,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
|
2
.github/workflows/samples-zapier.yaml
vendored
2
.github/workflows/samples-zapier.yaml
vendored
@ -20,7 +20,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
- name: Install dependencies
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: |
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -296,6 +296,9 @@ samples/openapi3/client/petstore/go/privatekey.pem
|
||||
|
||||
## OCaml
|
||||
samples/client/petstore/ocaml/_build/
|
||||
samples/client/petstore/ocaml-fake-petstore/_build/
|
||||
samples/client/petstore/ocaml-oneOf-primitive/_build/
|
||||
samples/client/petstore/ocaml-additional-properties/_build/
|
||||
|
||||
# jetbrain http client
|
||||
samples/client/jetbrains/adyen/checkout71/http/client/Apis/http-client.private.env.json
|
||||
|
219
.travis.yml
219
.travis.yml
@ -1,219 +0,0 @@
|
||||
sudo: required
|
||||
language: java
|
||||
jdk:
|
||||
- openjdk11
|
||||
|
||||
# See https://docs.travis-ci.com/user/languages/java/#caching
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
||||
# Avoid caching our built dependencies between runs.
|
||||
- rm -fr $HOME/.m2/repository/org/openapitools/
|
||||
|
||||
cache:
|
||||
yarn: true
|
||||
directories:
|
||||
- $HOME/.m2
|
||||
- $HOME/.ivy2
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
||||
- $HOME/samples/client/petstore/javascript/node_modules
|
||||
- $HOME/samples/client/petstore/php/OpenAPIToolsClient-php/vendor
|
||||
- $HOME/samples/client/petstore/ruby/vendor/bundle
|
||||
- $HOME/samples/client/petstore/python/.venv/
|
||||
- $HOME/samples/server/petstore/rust-server/target
|
||||
- $HOME/samples/server/petstore/rust-axum/target
|
||||
- $HOME/perl5
|
||||
- $HOME/.cargo
|
||||
- $HOME/.pub-cache
|
||||
- $HOME/samples/server/petstore/cpp-pistache/pistache
|
||||
- $HOME/.rvm/gems/ruby-2.4.1
|
||||
- $HOME/website/node_modules/
|
||||
- $HOME/.cache/deno
|
||||
- $HOME/.phpenv/versions/8.1.4
|
||||
|
||||
#services:
|
||||
# - docker
|
||||
|
||||
# comment out the host table change to use the public petstore server
|
||||
addons:
|
||||
#apt:
|
||||
# sources:
|
||||
# - ubuntu-toolchain-r-test
|
||||
# packages:
|
||||
# - g++-5
|
||||
#chrome: stable
|
||||
hosts:
|
||||
- petstore.swagger.io
|
||||
|
||||
before_install:
|
||||
# - sudo rm -rf /var/lib/apt/lists/*
|
||||
# - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||
# - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge"
|
||||
# - sudo apt-get update
|
||||
# #- sudo apt-get install -qqy --no-install-recommends google-chrome-stable
|
||||
# #- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
|
||||
# - mkdir -vp ~/.docker/cli-plugins/
|
||||
# - curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
|
||||
# - chmod a+x ~/.docker/cli-plugins/docker-buildx
|
||||
# # to run petstore server locally via docker
|
||||
#- echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin || true
|
||||
#- docker pull swaggerapi/petstore
|
||||
#- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
|
||||
#- docker ps -a
|
||||
# comment out crystal installation as the tests will run on circleci or github action instead
|
||||
# install crystal
|
||||
#- echo 'deb http://download.opensuse.org/repositories/devel:/languages:/crystal/xUbuntu_16.04/ /' | sudo tee /etc/apt/sources.list.d/devel:languages:crystal.list
|
||||
#- curl -fsSL https://download.opensuse.org/repositories/devel:languages:crystal/xUbuntu_16.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_languages_crystal.gpg > /dev/null
|
||||
#- sudo apt update
|
||||
#- sudo apt install crystal
|
||||
#- crystal --version
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.22.0
|
||||
- export PATH="$HOME/.yarn/bin:$PATH"
|
||||
# install rust
|
||||
#- curl https://sh.rustup.rs -sSf | sh -s -- -y -v
|
||||
## required when sudo: required for the Ruby petstore tests
|
||||
#- gem install bundler -v 2.3.26
|
||||
## set python 3.6.3 as default
|
||||
#- source ~/virtualenv/python3.6/bin/activate
|
||||
# -- skip bash test to shorten build time
|
||||
# Add bats test framework and cURL for Bash script integration tests
|
||||
#- sudo add-apt-repository ppa:duggan/bats --yes
|
||||
#- sudo apt-get update -qq
|
||||
#- sudo apt-get install -qq bats
|
||||
#- sudo apt-get install -qq curl
|
||||
# -- skip bash test end
|
||||
# install dart
|
||||
#- sudo apt-get update
|
||||
#- sudo apt-get install apt-transport-https
|
||||
#- sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
|
||||
#- sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
|
||||
#- sudo apt-get update
|
||||
#- sudo apt-get install dart
|
||||
# switch to php8
|
||||
#- sudo apt-get install -f libonig-dev libzip-dev
|
||||
#- git clone https://github.com/php-build/php-build $(phpenv root)/plugins/php-build
|
||||
#- git clone https://github.com/ngyuki/phpenv-composer.git $(phpenv root)/plugins/phpenv-composer
|
||||
#- if [ $(ls -A "$HOME/.phpenv/versions/8.1.4" | wc -l) -eq 0 ]; then
|
||||
# phpenv install 8.1.4;
|
||||
# fi;
|
||||
#- phpenv rehash
|
||||
#- phpenv versions
|
||||
##- phpenv global 7.2.15
|
||||
#- phpenv global 8.1.4
|
||||
#- php -v
|
||||
# comment out below as installation failed in travis
|
||||
# Add rebar3 build tool and recent Erlang/OTP for Erlang petstore server tests.
|
||||
# - Travis CI does not support rebar3 [yet](https://github.com/travis-ci/travis-ci/issues/6506#issuecomment-275189490).
|
||||
# - Rely on `kerl` for [pre-compiled versions available](https://docs.travis-ci.com/user/languages/erlang#Choosing-OTP-releases-to-test-against). Rely on installation path chosen by [`travis-erlang-builder`](https://github.com/travis-ci/travis-erlang-builder/blob/e6d016b1a91ca7ecac5a5a46395bde917ea13d36/bin/compile#L18).
|
||||
# - . ~/otp/18.2.1/activate && erl -version
|
||||
#- curl -f -L -o ./rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x ./rebar3 && ./rebar3 version && export PATH="${TRAVIS_BUILD_DIR}:$PATH"
|
||||
# install C++ tools
|
||||
#- sudo apt install -y --no-install-recommends valgrind cmake build-essential
|
||||
#- cmake --version
|
||||
# install Qt5
|
||||
#- sudo apt install -y --no-install-recommends qt5-default
|
||||
# install boost
|
||||
#- sudo apt install -y --no-install-recommends libboost-all-dev
|
||||
# perl dep
|
||||
#- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
|
||||
#- cpanm --quiet --no-interactive Test::Exception Test::More Log::Any LWP::UserAgent URI::Query Module::Runtime DateTime Module::Find Moose::Role JSON || echo "Ignored failure from cpanm"
|
||||
# show host table to confirm petstore.swagger.io is mapped to localhost
|
||||
- cat /etc/hosts
|
||||
# show java version
|
||||
- java -version
|
||||
- if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
openssl aes-256-cbc -K $encrypted_6e2c8bba47c6_key -iv $encrypted_6e2c8bba47c6_iv -in sec.gpg.enc -out sec.gpg -d ;
|
||||
gpg --keyserver keyserver.ubuntu.com --recv-key $SIGNING_KEY ;
|
||||
gpg --check-trustdb ;
|
||||
fi;
|
||||
- pushd .; cd website; yarn install; popd
|
||||
|
||||
script:
|
||||
# fail fast
|
||||
- set -e
|
||||
# show docker buildx version
|
||||
#- docker buildx version
|
||||
# run integration tests defined in maven pom.xml
|
||||
# WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet.
|
||||
# show "error" only to reduce the log size
|
||||
- ./mvnw -e --no-snapshot-updates --quiet --batch-mode --show-version clean install -DskipTests -Dmaven.javadoc.skip=true -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
after_success:
|
||||
# push to maven repo
|
||||
- if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ]; then
|
||||
echo "Publishing from branch $TRAVIS_BRANCH";
|
||||
./mvnw clean deploy --quiet -DskipTests=true -B -U -P release --settings CI/settings.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error;
|
||||
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
|
||||
pushd .;
|
||||
cd modules/openapi-generator-gradle-plugin;
|
||||
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" publishPluginMavenPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository;
|
||||
echo "Finished ./gradlew publishPluginMavenPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository";
|
||||
popd;
|
||||
elif [ -z $TRAVIS_TAG ] && [[ "$TRAVIS_BRANCH" =~ ^[0-9]+\.[0-9]+\.x$ ]]; then
|
||||
echo "Publishing from branch $TRAVIS_BRANCH";
|
||||
./mvnw clean deploy --quiet --settings CI/settings.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error;
|
||||
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
|
||||
pushd .;
|
||||
cd modules/openapi-generator-gradle-plugin;
|
||||
./gradlew -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" publishPluginMavenPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository;
|
||||
echo "Finished ./gradlew publishPluginMavenPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository";
|
||||
popd;
|
||||
fi;
|
||||
if [ -n $TRAVIS_TAG ] && [[ "$TRAVIS_TAG" =~ ^[v][0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Publishing the gradle plugin to Gradle Portal on tag $TRAVIS_TAG (only)";
|
||||
pushd .;
|
||||
cd modules/openapi-generator-gradle-plugin;
|
||||
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" publishPlugins -Dgradle.publish.key=$GRADLE_PUBLISH_KEY -Dgradle.publish.secret=$GRADLE_PUBLISH_SECRET;
|
||||
echo "Finished ./gradlew publishPlugins (plugin portal)";
|
||||
popd;
|
||||
fi;
|
||||
fi;
|
||||
# ## docker: build and push openapi-generator-online to DockerHub
|
||||
# - if [ $DOCKER_HUB_USERNAME ]; then
|
||||
# echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin;
|
||||
# export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[');
|
||||
# export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ");
|
||||
# docker buildx create --use;
|
||||
# if [ ! -z "$TRAVIS_TAG" ]; then
|
||||
# docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME:latest -t $DOCKER_GENERATOR_IMAGE_NAME:$TRAVIS_TAG -t $DOCKER_GENERATOR_IMAGE_NAME -t $DOCKER_GENERATOR_IMAGE_NAME:latest-release ./modules/openapi-generator-online;
|
||||
# echo "Built and tagged $DOCKER_GENERATOR_IMAGE_NAME";
|
||||
# fi;
|
||||
# if [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
|
||||
# docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online;
|
||||
# echo "Pushed to $DOCKER_GENERATOR_IMAGE_NAME for master";
|
||||
# fi;
|
||||
# fi;
|
||||
## ## docker: build cli image and push to Docker Hub
|
||||
# - if [ $DOCKER_HUB_USERNAME ]; then
|
||||
# echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin;
|
||||
# cp docker-entrypoint.sh ./modules/openapi-generator-cli;
|
||||
# export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[');
|
||||
# export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ");
|
||||
# docker buildx create --use;
|
||||
# docker buildx build --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli;
|
||||
# if [ ! -z "$TRAVIS_TAG" ]; then
|
||||
# docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:$TRAVIS_TAG -t $DOCKER_CODEGEN_CLI_IMAGE_NAME -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest-release ./modules/openapi-generator-cli;
|
||||
# echo "Built and tagged $DOCKER_GENERATOR_IMAGE_NAME";
|
||||
# fi;
|
||||
# if [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
|
||||
# docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli;
|
||||
# echo "Pushed to $DOCKER_CODEGEN_CLI_IMAGE_NAME";
|
||||
# fi;
|
||||
# fi;
|
||||
# ## NOTE; we will do the followign manually instead as the page doesn't need to be updated in every single travis build
|
||||
## publish latest website, variables below are secure environment variables which are unavailable to PRs from forks.
|
||||
# - if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
# sed -i "s/Vector{UInt8}/Vector\{UInt8\}/g" docs/generators/julia-client.md;
|
||||
# sed -i "s/Vector{UInt8}/Vector\{UInt8\}/g" docs/generators/julia-server.md;
|
||||
# cd website;
|
||||
# git config --global user.name "${GH_NAME}";
|
||||
# git config --global user.email "${GH_EMAIL}";
|
||||
# echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc;
|
||||
# yarn install;
|
||||
# GIT_USER="${GH_NAME}" yarn run publish-gh-pages;
|
||||
# fi;
|
||||
#
|
||||
env:
|
||||
- DOCKER_GENERATOR_IMAGE_NAME=openapitools/openapi-generator-online DOCKER_CODEGEN_CLI_IMAGE_NAME=openapitools/openapi-generator-cli NODE_ENV=test CC=gcc-5 CXX=g++-5
|
||||
|
20
README.md
20
README.md
@ -15,7 +15,7 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.15.0`):
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.16.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)
|
||||
@ -150,8 +150,8 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
||||
|
||||
| OpenAPI Generator Version | Release Date | Notes |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
|
||||
| 7.15.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.15.0-SNAPSHOT/) | 29.07.2025 | Minor release with breaking changes (with fallback) |
|
||||
| [7.14.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.14.0) (latest stable release) | 25.06.2025 | Minor release with breaking changes (with fallback) |
|
||||
| 7.16.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.16.0-SNAPSHOT/) | 22.09.2025 | Minor release with breaking changes (with fallback) |
|
||||
| [7.15.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.15.0) (latest stable release) | 22.08.2025 | 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) |
|
||||
@ -214,16 +214,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.14.0/openapi-generator-cli-7.14.0.jar`
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.15.0/openapi-generator-cli-7.15.0.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
```sh
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.14.0/openapi-generator-cli-7.14.0.jar -O openapi-generator-cli.jar
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.15.0/openapi-generator-cli-7.15.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.14.0/openapi-generator-cli-7.14.0.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.15.0/openapi-generator-cli-7.15.0.jar
|
||||
```
|
||||
|
||||
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
|
||||
@ -458,7 +458,7 @@ openapi-generator-cli version
|
||||
To use a specific version of "openapi-generator-cli"
|
||||
|
||||
```sh
|
||||
openapi-generator-cli version-manager set 7.14.0
|
||||
openapi-generator-cli version-manager set 7.15.0
|
||||
```
|
||||
|
||||
Or install it as dev-dependency:
|
||||
@ -482,7 +482,7 @@ pip install openapi-generator-cli
|
||||
|
||||
To install a specific version
|
||||
```
|
||||
pip install openapi-generator-cli==7.14.0
|
||||
pip install openapi-generator-cli==7.15.0
|
||||
```
|
||||
|
||||
You can also install with [jdk4py](https://github.com/activeviam/jdk4py) instead of java binary. (python>=3.10 is required)
|
||||
@ -508,7 +508,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
|
||||
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g php -o c:\temp\php_api_client`)
|
||||
|
||||
<!-- RELEASE_VERSION -->
|
||||
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.14.0/openapi-generator-cli-7.14.0.jar)
|
||||
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.15.0/openapi-generator-cli-7.15.0.jar)
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`
|
||||
@ -1264,7 +1264,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| Nim | |
|
||||
| NodeJS/Javascript | @CodeNinjai (2017/07) @frol (2017/07) @cliffano (2017/07) |
|
||||
| ObjC | |
|
||||
| OCaml | @cgensoul (2019/08) |
|
||||
| OCaml | @cgensoul (2019/08), @sir4ur0n (2025/08) |
|
||||
| Perl | @wing328 (2017/07) [:heart:](https://www.patreon.com/wing328) @yue9944882 (2019/06) |
|
||||
| PHP | @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), [@ybelenko](https://github.com/ybelenko) (2018/07), @renepardon (2018/12) |
|
||||
| PowerShell | @wing328 (2020/05) |
|
||||
|
@ -1,9 +1,9 @@
|
||||
generatorName: kotlin
|
||||
outputDir: samples/client/petstore/kotlin-allOff-discriminator-kotlinx-serialization
|
||||
outputDir: samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/polymorphism.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
|
||||
additionalProperties:
|
||||
artifactId: kotlin-allOff-discriminator
|
||||
artifactId: kotlin-allOf-discriminator
|
||||
serializableModel: "false"
|
||||
dateLibrary: java8
|
||||
enumUnknownDefaultCase: true
|
@ -1,9 +1,9 @@
|
||||
generatorName: kotlin
|
||||
outputDir: samples/client/petstore/kotlin-allOff-discriminator
|
||||
outputDir: samples/client/petstore/kotlin-allOf-discriminator
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue_10792.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
|
||||
additionalProperties:
|
||||
artifactId: kotlin-allOff-discriminator
|
||||
artifactId: kotlin-allOf-discriminator
|
||||
serializableModel: "false"
|
||||
dateLibrary: java8
|
||||
enumUnknownDefaultCase: true
|
@ -0,0 +1,8 @@
|
||||
generatorName: kotlin
|
||||
outputDir: samples/client/petstore/kotlin-multiplatform-allOf-discriminator
|
||||
library: multiplatform
|
||||
dateLibrary: kotlinx-datetime
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/polymorphism.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
|
||||
additionalProperties:
|
||||
artifactId: kotlin-multiplatform-allOf-discriminator
|
6
bin/configs/ocaml-additional-properties.yaml
Normal file
6
bin/configs/ocaml-additional-properties.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
generatorName: ocaml
|
||||
outputDir: samples/client/petstore/ocaml-additional-properties
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/ocaml/additional-properties.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/ocaml
|
||||
additionalProperties:
|
||||
packageName: petstore_client
|
6
bin/configs/ocaml-fake-petstore.yaml
Normal file
6
bin/configs/ocaml-fake-petstore.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
generatorName: ocaml
|
||||
outputDir: samples/client/petstore/ocaml-fake-petstore
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/ocaml
|
||||
additionalProperties:
|
||||
packageName: petstore_client
|
6
bin/configs/ocaml-oneOf-primitive.yaml
Normal file
6
bin/configs/ocaml-oneOf-primitive.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
generatorName: ocaml
|
||||
outputDir: samples/client/petstore/ocaml-oneOf-primitive
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf_primitive.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/ocaml
|
||||
additionalProperties:
|
||||
packageName: petstore_client
|
@ -96,7 +96,7 @@ mvn integration-test
|
||||
### Which Swift generator is still actively maintained?
|
||||
|
||||
Please use `swift5` generator because Swift 4.x is deprecated.
|
||||
There is a new `swift6` generator, that is currently in beta, try it and give us your feedback.
|
||||
There is a new `swift6` generator, that is now stable, try it and give us your feedback.
|
||||
|
||||
### How do I implement bearer token authentication with URLSession on the Swift 5 API client?
|
||||
|
||||
|
@ -68,7 +68,7 @@ The following generators are available:
|
||||
* [scalaz](generators/scalaz.md)
|
||||
* [swift-combine](generators/swift-combine.md)
|
||||
* [swift5](generators/swift5.md)
|
||||
* [swift6 (beta)](generators/swift6.md)
|
||||
* [swift6](generators/swift6.md)
|
||||
* [typescript (experimental)](generators/typescript.md)
|
||||
* [typescript-angular](generators/typescript-angular.md)
|
||||
* [typescript-aurelia](generators/typescript-aurelia.md)
|
||||
|
@ -37,6 +37,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|pubRepository|Repository in generated pubspec| |null|
|
||||
|pubVersion|Version in generated pubspec| |1.0.0|
|
||||
|serializationLibrary|Specify serialization library|<dl><dt>**built_value**</dt><dd>[DEFAULT] built_value</dd><dt>**json_serializable**</dt><dd>[BETA] json_serializable</dd></dl>|built_value|
|
||||
|skipCopyWith|Skip CopyWith when using Json Serializable for serialization| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|sourceFolder|source folder for generated code| |src|
|
||||
|
@ -68,7 +68,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
|
||||
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|
||||
|invokerPackage|root package for generated code| |org.openapitools.api|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|false|
|
||||
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd><dt>**spring-http-interface**</dt><dd>Spring 6 HTTP interfaces (testing)</dd></dl>|spring-boot|
|
||||
|licenseName|The name of the license| |Unlicense|
|
||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||
@ -103,7 +103,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useFeignClientContextId|Whether to generate Feign client with contextId parameter.| |true|
|
||||
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|
||||
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|
||||
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false|
|
||||
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |true|
|
||||
|useOptional|Use Optional container for optional parameters| |false|
|
||||
|useResponseEntity|Use the `ResponseEntity` type to wrap return values of generated API methods. If disabled, method are annotated using a `@ResponseStatus` annotation, which has the status of the first response declared in the Api definition| |true|
|
||||
|useSealed|Whether to generate sealed model interfaces and classes| |false|
|
||||
|
@ -209,8 +209,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|Polymorphism|✗|OAS2,OAS3
|
||||
|Union|✗|OAS3
|
||||
|allOf|✗|OAS2,OAS3
|
||||
|anyOf|✗|OAS3
|
||||
|oneOf|✗|OAS3
|
||||
|anyOf|✓|OAS3
|
||||
|oneOf|✓|OAS3
|
||||
|not|✗|OAS3
|
||||
|
||||
### Security Feature
|
||||
|
@ -61,7 +61,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
|
||||
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|
||||
|invokerPackage|root package for generated code| |org.openapitools.api|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|false|
|
||||
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd><dt>**spring-http-interface**</dt><dd>Spring 6 HTTP interfaces (testing)</dd></dl>|spring-boot|
|
||||
|licenseName|The name of the license| |Unlicense|
|
||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||
@ -96,7 +96,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useFeignClientContextId|Whether to generate Feign client with contextId parameter.| |true|
|
||||
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|
||||
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|
||||
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false|
|
||||
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |true|
|
||||
|useOptional|Use Optional container for optional parameters| |false|
|
||||
|useResponseEntity|Use the `ResponseEntity` type to wrap return values of generated API methods. If disabled, method are annotated using a `@ResponseStatus` annotation, which has the status of the first response declared in the Api definition| |true|
|
||||
|useSealed|Whether to generate sealed model interfaces and classes| |false|
|
||||
|
@ -7,7 +7,7 @@ title: Documentation for the swift6 Generator
|
||||
| Property | Value | Notes |
|
||||
| -------- | ----- | ----- |
|
||||
| generator name | swift6 | pass this to the generate command after -g |
|
||||
| generator stability | BETA | |
|
||||
| generator stability | STABLE | |
|
||||
| generator type | CLIENT | |
|
||||
| generator language | Swift | |
|
||||
| generator default templating engine | mustache | |
|
||||
|
@ -22,7 +22,7 @@ npm install @openapitools/openapi-generator-cli -g
|
||||
To install a specific version of the tool, pass the version during installation:
|
||||
<!-- RELEASE_VERSION -->
|
||||
```bash
|
||||
openapi-generator-cli version-manager set 7.14.0
|
||||
openapi-generator-cli version-manager set 7.15.0
|
||||
```
|
||||
<!-- /RELEASE_VERSION -->
|
||||
To install the tool as a dev dependency in your current project:
|
||||
@ -119,18 +119,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.14.0/openapi-generator-cli-7.14.0.jar`
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.15.0/openapi-generator-cli-7.15.0.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
|
||||
```bash
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.14.0/openapi-generator-cli-7.14.0.jar -O openapi-generator-cli.jar
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.15.0/openapi-generator-cli-7.15.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.14.0/openapi-generator-cli-7.14.0.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.15.0/openapi-generator-cli-7.15.0.jar
|
||||
```
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
|
@ -16,7 +16,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
|
||||
<plugin>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<version>7.14.0</version>
|
||||
<version>7.15.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.15.0</version>
|
||||
<version>7.16.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.15.0</version>
|
||||
<version>7.16.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.14.0"
|
||||
id "org.openapi.generator" version "7.15.0"
|
||||
}
|
||||
----
|
||||
|
||||
@ -113,7 +113,7 @@ buildscript {
|
||||
// url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:7.14.0"
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:7.15.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -759,7 +759,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath('org.openapitools:openapi-generator-gradle-plugin:7.14.0') {
|
||||
classpath('org.openapitools:openapi-generator-gradle-plugin:7.15.0') {
|
||||
exclude group: 'com.google.guava'
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=7.15.0
|
||||
openApiGeneratorVersion=7.16.0-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
# BEGIN placeholders
|
||||
|
@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.15.0</version>
|
||||
<version>7.16.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.14.0 openApiValidate
|
||||
gradle -PopenApiGeneratorVersion=7.15.0 openApiValidate
|
||||
```
|
||||
|
@ -1,3 +1,3 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=7.15.0
|
||||
openApiGeneratorVersion=7.16.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.14.0</version>
|
||||
<version>7.15.0</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.15.0</version>
|
||||
<version>7.16.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.15.0</version>
|
||||
<version>7.16.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.15.0</version>
|
||||
<version>7.16.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.15.0</version>
|
||||
<version>7.16.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.15.0</version>
|
||||
<version>7.16.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.15.0</version>
|
||||
<version>7.16.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.15.0</version>
|
||||
<version>7.16.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
@ -321,6 +321,12 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter(name = "generateAliasAsModel", property = "openapi.generator.maven.plugin.generateAliasAsModel")
|
||||
private Boolean generateAliasAsModel;
|
||||
|
||||
/**
|
||||
* Only write output files that have changed.
|
||||
*/
|
||||
@Parameter(name = "minimalUpdate", property = "openapi.generator.maven.plugin.minimalUpdate")
|
||||
private Boolean minimalUpdate;
|
||||
|
||||
/**
|
||||
* A map of language-specific parameters as passed with the -c option to the command line
|
||||
*/
|
||||
@ -698,6 +704,10 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
configurator.setGenerateAliasAsModel(generateAliasAsModel);
|
||||
}
|
||||
|
||||
if (minimalUpdate != null) {
|
||||
configurator.setEnableMinimalUpdate(minimalUpdate);
|
||||
}
|
||||
|
||||
if (isNotEmpty(generatorName)) {
|
||||
configurator.setGeneratorName(generatorName);
|
||||
} else {
|
||||
|
@ -38,6 +38,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@ -88,6 +89,17 @@ public class CodeGenMojoTest extends BaseTestCase {
|
||||
assertEquals("joda", configOptions.get("dateLibrary"));
|
||||
}
|
||||
|
||||
public void testMinimalUpdateConfiguration() throws Exception {
|
||||
// GIVEN
|
||||
CodeGenMojo mojo = loadMojo(newTempFolder(), "src/test/resources/minimal-update", null);
|
||||
|
||||
// WHEN
|
||||
mojo.execute();
|
||||
|
||||
// THEN
|
||||
assertEquals(Boolean.TRUE, getVariableValueFromObject(mojo, "minimalUpdate"));
|
||||
}
|
||||
|
||||
public void testHashGenerationFileContainsExecutionId() throws Exception {
|
||||
// GIVEN
|
||||
final Path tempDir = newTempFolder();
|
||||
@ -136,6 +148,50 @@ public class CodeGenMojoTest extends BaseTestCase {
|
||||
assertFalse("src directory should not have been regenerated", Files.exists(generatedDir.resolve("src")));
|
||||
}
|
||||
|
||||
public void testMinimalUpdate() throws Exception {
|
||||
//GIVEN
|
||||
/* Set up the mojo */
|
||||
final Path tempDir = newTempFolder();
|
||||
final CodeGenMojo mojo = loadMojo(tempDir, "src/test/resources/minimal-update", null, "executionId");
|
||||
|
||||
/* Perform an initial generation */
|
||||
mojo.execute();
|
||||
|
||||
/* Collect last modified times of generated files */
|
||||
final Path generatedDir = tempDir.resolve("target/generated-sources/minimal-update");
|
||||
assertTrue("Generated directory should exist", Files.exists(generatedDir));
|
||||
|
||||
Map<Path, Long> lastModifiedTimes = new HashMap<>();
|
||||
try (Stream<Path> files = Files.walk(generatedDir)) {
|
||||
files
|
||||
.filter(Files::isRegularFile)
|
||||
.filter(path -> !path.getFileName().toString().endsWith(".sha256"))
|
||||
.filter(path -> !path.getFileName().toString().equals("FILES"))
|
||||
.forEach(file -> {
|
||||
try {
|
||||
lastModifiedTimes.put(file, Files.getLastModifiedTime(file).toMillis());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
assertTrue("Should have recorded last modified times for more than 3 files", lastModifiedTimes.size() > 3);
|
||||
|
||||
// WHEN
|
||||
/* Execute the mojo again */
|
||||
mojo.execute();
|
||||
|
||||
// THEN
|
||||
/* Verify that file modification times haven't changed (files weren't touched) */
|
||||
for (Map.Entry<Path, Long> entry : lastModifiedTimes.entrySet()) {
|
||||
Path file = entry.getKey();
|
||||
Long originalTime = entry.getValue();
|
||||
Long currentTime = Files.getLastModifiedTime(file).toMillis();
|
||||
assertEquals("File " + file + " should not have been modified (minimal update should skip unchanged files)",
|
||||
originalTime, currentTime);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For a Pom file which refers to an input file which will be on the classpath, as opposed to a file path,
|
||||
* test that the generated source is regenerated when the hash has changed.
|
||||
|
@ -0,0 +1,52 @@
|
||||
<!--
|
||||
~ Copyright 2020, 2021 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>minimal.update.test</groupId>
|
||||
<artifactId>minimal-update-test</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>OpenAPI Generator Minimal Update Test</name>
|
||||
<url>https://openapi-generator.tech/</url>
|
||||
<build>
|
||||
<finalName>minimal-update-test</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<inputSpec>petstore-on-classpath.yaml</inputSpec>
|
||||
<generatorName>spring</generatorName>
|
||||
<output>${basedir}/target/generated-sources/minimal-update</output>
|
||||
<minimalUpdate>true</minimalUpdate>
|
||||
<configOptions>
|
||||
<hideGenerationTimestamp>true</hideGenerationTimestamp>
|
||||
</configOptions>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>executionId</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.15.0</version>
|
||||
<version>7.16.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.15.0</version>
|
||||
<version>7.16.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
@ -47,6 +47,7 @@ import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
import static org.openapitools.codegen.utils.ModelUtils.getSchemaItems;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
@ -1602,33 +1603,28 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
/**
|
||||
* Provides C# strongly typed declaration for simple arrays of some type and arrays of arrays of some type.
|
||||
*
|
||||
* @param arr The input array property
|
||||
* @param items The input array property
|
||||
* @return The type declaration when the type is an array of arrays.
|
||||
*/
|
||||
private String getArrayTypeDeclaration(Schema arr) {
|
||||
// TODO: collection type here should be fully qualified namespace to avoid model conflicts
|
||||
// This supports arrays of arrays.
|
||||
String arrayType = typeMapping.get("array");
|
||||
StringBuilder instantiationType = new StringBuilder(arrayType);
|
||||
Schema<?> items = ModelUtils.getSchemaItems(arr);
|
||||
String nestedType = getTypeDeclaration(items);
|
||||
// TODO: We may want to differentiate here between generics and primitive arrays.
|
||||
instantiationType.append("<").append(nestedType).append(">");
|
||||
return instantiationType.toString();
|
||||
private String getTypeDeclarationForArray(Schema<?> items) {
|
||||
return getTypeDeclaration(items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toInstantiationType(Schema p) {
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
return getArrayTypeDeclaration(p);
|
||||
return getTypeDeclarationForArray(p);
|
||||
}
|
||||
return super.toInstantiationType(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(Schema p) {
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
return getArrayTypeDeclaration(p);
|
||||
Schema<?> schema = unaliasSchema(p);
|
||||
Schema<?> target = ModelUtils.isGenerateAliasAsModel() ? p : schema;
|
||||
if (ModelUtils.isArraySchema(target)) {
|
||||
Schema<?> items = getSchemaItems(schema);
|
||||
return getSchemaType(target) + "<" + getTypeDeclarationForArray(items) + ">";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
// Should we also support maps of maps?
|
||||
Schema<?> inner = ModelUtils.getAdditionalProperties(p);
|
||||
|
@ -800,6 +800,9 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
|
||||
if (withXml) {
|
||||
goDataTag += " xml:" + "\"" + cp.baseName;
|
||||
if (cp.isXmlWrapped) {
|
||||
goDataTag += ">" + ("".equals(cp.xmlName) ? cp.baseName : cp.xmlName);
|
||||
}
|
||||
if (cp.isXmlAttribute) {
|
||||
goDataTag += ",attr";
|
||||
}
|
||||
|
@ -1748,7 +1748,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
|
||||
@Override
|
||||
protected void updateModelForObject(CodegenModel m, Schema schema) {
|
||||
/**
|
||||
/*
|
||||
* we have a custom version of this function so we only set isMap to true if
|
||||
* ModelUtils.isMapSchema
|
||||
* In other generators, isMap is true for all type object schemas
|
||||
|
@ -1058,7 +1058,7 @@ public class CSharpReducedClientCodegen extends AbstractCSharpCodegen {
|
||||
@Override
|
||||
public String toInstantiationType(Schema schema) {
|
||||
if (ModelUtils.isMapSchema(schema)) {
|
||||
Schema additionalProperties = ModelUtils.getAdditionalProperties(schema);
|
||||
Schema<?> additionalProperties = ModelUtils.getAdditionalProperties(schema);
|
||||
String inner = getSchemaType(additionalProperties);
|
||||
if (ModelUtils.isMapSchema(additionalProperties)) {
|
||||
inner = toInstantiationType(additionalProperties);
|
||||
|
@ -69,7 +69,9 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
|
||||
private static final String DIO_IMPORT = "package:dio/dio.dart";
|
||||
public static final String FINAL_PROPERTIES = "finalProperties";
|
||||
public static final String SKIP_COPY_WITH = "skipCopyWith";
|
||||
public static final String FINAL_PROPERTIES_DEFAULT_VALUE = "true";
|
||||
public static final String SKIP_COPY_WITH_DEFAULT_VALUE = "false";
|
||||
|
||||
private static final String CLIENT_NAME = "clientName";
|
||||
|
||||
@ -138,6 +140,11 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
final CliOption finalProperties = CliOption.newBoolean(FINAL_PROPERTIES, "Whether properties are marked as final when using Json Serializable for serialization");
|
||||
finalProperties.setDefault("true");
|
||||
cliOptions.add(finalProperties);
|
||||
|
||||
// skip CopyWith option
|
||||
final CliOption skipCopyWith = CliOption.newBoolean(SKIP_COPY_WITH, "Skip CopyWith when using Json Serializable for serialization");
|
||||
skipCopyWith.setDefault("false");
|
||||
cliOptions.add(skipCopyWith);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -182,6 +189,13 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
additionalProperties.put(FINAL_PROPERTIES, Boolean.parseBoolean(additionalProperties.get(FINAL_PROPERTIES).toString()));
|
||||
}
|
||||
|
||||
if (!additionalProperties.containsKey(SKIP_COPY_WITH)) {
|
||||
additionalProperties.put(SKIP_COPY_WITH, Boolean.parseBoolean(SKIP_COPY_WITH_DEFAULT_VALUE));
|
||||
LOGGER.debug("skipCopyWith not set, using default {}", SKIP_COPY_WITH_DEFAULT_VALUE);
|
||||
} else {
|
||||
additionalProperties.put(SKIP_COPY_WITH, Boolean.parseBoolean(additionalProperties.get(SKIP_COPY_WITH).toString()));
|
||||
}
|
||||
|
||||
if (!additionalProperties.containsKey(CLIENT_NAME)) {
|
||||
final String name = org.openapitools.codegen.utils.StringUtils.camelize(pubName);
|
||||
additionalProperties.put(CLIENT_NAME, name);
|
||||
|
@ -966,7 +966,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
@Override
|
||||
public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs) {
|
||||
objs = super.postProcessAllModels(objs);
|
||||
if (getSerializationLibrary() == SERIALIZATION_LIBRARY_TYPE.kotlinx_serialization) {
|
||||
if (getSerializationLibrary() == SERIALIZATION_LIBRARY_TYPE.kotlinx_serialization || getLibrary().equals(MULTIPLATFORM)) {
|
||||
// The loop removes unneeded variables so commas are handled correctly in the related templates
|
||||
for (Map.Entry<String, ModelsMap> modelsMap : objs.entrySet()) {
|
||||
for (ModelMap mo : modelsMap.getValue().getModels()) {
|
||||
|
@ -20,7 +20,6 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Mustache.Lambda;
|
||||
import com.samskivert.mustache.Template;
|
||||
import io.swagger.v3.oas.models.Components;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import lombok.Getter;
|
||||
@ -425,6 +424,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
importMapping.put("JsonProperty", "com.fasterxml.jackson.annotation.JsonProperty");
|
||||
importMapping.put("JsonSubTypes", "com.fasterxml.jackson.annotation.JsonSubTypes");
|
||||
importMapping.put("JsonTypeInfo", "com.fasterxml.jackson.annotation.JsonTypeInfo");
|
||||
importMapping.put("JsonIgnoreProperties", "com.fasterxml.jackson.annotation.JsonIgnoreProperties");
|
||||
// import JsonCreator if JsonProperty is imported
|
||||
// used later in recursive import in postProcessingModels
|
||||
importMapping.put("com.fasterxml.jackson.annotation.JsonProperty", "com.fasterxml.jackson.annotation.JsonCreator");
|
||||
@ -827,7 +827,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
}
|
||||
|
||||
if (model.discriminator != null && additionalProperties.containsKey("jackson")) {
|
||||
model.imports.addAll(Arrays.asList("JsonSubTypes", "JsonTypeInfo"));
|
||||
model.imports.addAll(Arrays.asList("JsonSubTypes", "JsonTypeInfo", "JsonIgnoreProperties"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,6 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
static final String X_MODEL_MODULE = "x-model-module";
|
||||
|
||||
public static final String CO_HTTP = "cohttp";
|
||||
|
||||
@Setter protected String packageName = "openapi";
|
||||
@Setter protected String packageVersion = "1.0.0";
|
||||
protected String apiDocPath = "docs/";
|
||||
@ -97,12 +95,15 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
.excludeSchemaSupportFeatures(
|
||||
SchemaSupportFeature.Polymorphism
|
||||
)
|
||||
.includeSchemaSupportFeatures(
|
||||
SchemaSupportFeature.oneOf,
|
||||
SchemaSupportFeature.anyOf
|
||||
)
|
||||
.includeClientModificationFeatures(
|
||||
ClientModificationFeature.BasePath
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
outputFolder = "generated-code/ocaml";
|
||||
modelTemplateFiles.put("model.mustache", ".ml");
|
||||
|
||||
@ -133,6 +134,7 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
supportingFiles.add(new SupportingFile("dune.mustache", "", "dune"));
|
||||
supportingFiles.add(new SupportingFile("dune-project.mustache", "", "dune-project"));
|
||||
supportingFiles.add(new SupportingFile("readme.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("ocamlformat.mustache", "", ".ocamlformat"));
|
||||
|
||||
defaultIncludes = new HashSet<>(
|
||||
Arrays.asList(
|
||||
@ -171,6 +173,7 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
typeMapping.put("short", "int");
|
||||
typeMapping.put("char", "char");
|
||||
typeMapping.put("float", "float");
|
||||
typeMapping.put("decimal", "string");
|
||||
typeMapping.put("double", "float");
|
||||
typeMapping.put("integer", "int32");
|
||||
typeMapping.put("number", "float");
|
||||
@ -179,6 +182,7 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
typeMapping.put("any", "Yojson.Safe.t");
|
||||
typeMapping.put("file", "string");
|
||||
typeMapping.put("ByteArray", "string");
|
||||
typeMapping.put("AnyType", "Yojson.Safe.t");
|
||||
// lib
|
||||
typeMapping.put("string", "string");
|
||||
typeMapping.put("UUID", "string");
|
||||
@ -186,15 +190,6 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
typeMapping.put("set", "`Set");
|
||||
typeMapping.put("password", "string");
|
||||
typeMapping.put("DateTime", "string");
|
||||
|
||||
// supportedLibraries.put(CO_HTTP, "HTTP client: CoHttp.");
|
||||
//
|
||||
// CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use.");
|
||||
// libraryOption.setEnum(supportedLibraries);
|
||||
// // set hyper as the default
|
||||
// libraryOption.setDefault(CO_HTTP);
|
||||
// cliOptions.add(libraryOption);
|
||||
// setLibrary(CO_HTTP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -202,13 +197,12 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
List<String> toRemove = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<String, ModelsMap> modelEntry : superobjs.entrySet()) {
|
||||
// process enum in models
|
||||
List<ModelMap> models = modelEntry.getValue().getModels();
|
||||
for (ModelMap mo : models) {
|
||||
CodegenModel cm = mo.getModel();
|
||||
|
||||
// for enum model
|
||||
if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) {
|
||||
if (cm.isEnum && cm.allowableValues != null) {
|
||||
toRemove.add(modelEntry.getKey());
|
||||
} else {
|
||||
enrichPropertiesWithEnumDefaultValues(cm.getAllVars());
|
||||
@ -219,6 +213,15 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
enrichPropertiesWithEnumDefaultValues(cm.getVars());
|
||||
enrichPropertiesWithEnumDefaultValues(cm.getParentVars());
|
||||
}
|
||||
|
||||
if (!cm.oneOf.isEmpty()) {
|
||||
// Add a boolean if it is a `oneOf`, because Mustache does not let us check if a list is non-empty
|
||||
cm.getVendorExtensions().put("x-ocaml-isOneOf", true);
|
||||
}
|
||||
if (!cm.anyOf.isEmpty()) {
|
||||
// Add a boolean if it is a `anyOf`, because Mustache does not let us check if a list is non-empty
|
||||
cm.getVendorExtensions().put("x-ocaml-isAnyOf", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,8 +245,7 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
@Override
|
||||
protected void updateDataTypeWithEnumForMap(CodegenProperty property) {
|
||||
CodegenProperty baseItem = property.items;
|
||||
while (baseItem != null && (Boolean.TRUE.equals(baseItem.isMap)
|
||||
|| Boolean.TRUE.equals(baseItem.isArray))) {
|
||||
while (baseItem != null && (baseItem.isMap || baseItem.isArray)) {
|
||||
baseItem = baseItem.items;
|
||||
}
|
||||
|
||||
@ -260,8 +262,7 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
@Override
|
||||
protected void updateDataTypeWithEnumForArray(CodegenProperty property) {
|
||||
CodegenProperty baseItem = property.items;
|
||||
while (baseItem != null && (Boolean.TRUE.equals(baseItem.isMap)
|
||||
|| Boolean.TRUE.equals(baseItem.isArray))) {
|
||||
while (baseItem != null && (baseItem.isMap || baseItem.isArray)) {
|
||||
baseItem = baseItem.items;
|
||||
}
|
||||
if (baseItem != null) {
|
||||
@ -312,19 +313,17 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
collectEnumSchemas(parentName, sName, schema);
|
||||
|
||||
if (schema.getProperties() != null) {
|
||||
String pName = parentName != null ? parentName + "_" + sName : sName;
|
||||
if (schema.getProperties() != null) {
|
||||
collectEnumSchemas(pName, schema.getProperties());
|
||||
}
|
||||
|
||||
if (schema.getAdditionalProperties() != null && schema.getAdditionalProperties() instanceof Schema) {
|
||||
String pName = parentName != null ? parentName + "_" + sName : sName;
|
||||
collectEnumSchemas(pName, (Schema) schema.getAdditionalProperties());
|
||||
}
|
||||
|
||||
if (ModelUtils.isArraySchema(schema)) {
|
||||
if (ModelUtils.getSchemaItems(schema) != null) {
|
||||
String pName = parentName != null ? parentName + "_" + sName : sName;
|
||||
collectEnumSchemas(pName, ModelUtils.getSchemaItems(schema));
|
||||
}
|
||||
}
|
||||
@ -677,7 +676,7 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
public String toEnumValueName(String name) {
|
||||
if (reservedWords.contains(name)) {
|
||||
return escapeReservedWord(name);
|
||||
} else if (((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains(String.valueOf((char) character)))) {
|
||||
} else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character)))) {
|
||||
return escape(name, specialCharReplacements, Collections.singletonList("_"), null);
|
||||
} else {
|
||||
return name;
|
||||
@ -723,8 +722,6 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
List<CodegenOperation> operations = objectMap.getOperation();
|
||||
|
||||
for (CodegenOperation operation : operations) {
|
||||
// http method verb conversion, depending on client library (e.g. Hyper: PUT => Put, Reqwest: PUT => put)
|
||||
//if (CO_HTTP.equals(getLibrary())) {
|
||||
for (CodegenParameter param : operation.bodyParams) {
|
||||
if (param.isModel && param.dataType.endsWith(".t")) {
|
||||
param.vendorExtensions.put(X_MODEL_MODULE, param.dataType.substring(0, param.dataType.lastIndexOf('.')));
|
||||
|
@ -546,25 +546,35 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf
|
||||
* @param allowableValues allowable values
|
||||
*/
|
||||
public void addUnspecifiedToAllowableValues(Map<String, Object> allowableValues) {
|
||||
|
||||
final String UNSPECIFIED = "UNSPECIFIED";
|
||||
|
||||
if (startEnumsWithUnspecified) {
|
||||
if (allowableValues.containsKey("enumVars")) {
|
||||
List<Map<String, Object>> enumVars = (List<Map<String, Object>>) allowableValues.get("enumVars");
|
||||
|
||||
HashMap<String, Object> unspecified = new HashMap<String, Object>();
|
||||
unspecified.put("name", "UNSPECIFIED");
|
||||
unspecified.put("isString", "false");
|
||||
unspecified.put("value", "\"UNSPECIFIED\"");
|
||||
enumVars.add(0, unspecified);
|
||||
boolean unspecifiedPresent = enumVars.stream()
|
||||
.anyMatch(e -> {
|
||||
return UNSPECIFIED.equals(e.get("name"));
|
||||
});
|
||||
if (!unspecifiedPresent) {
|
||||
HashMap<String, Object> unspecifiedEnum = new HashMap<String, Object>();
|
||||
unspecifiedEnum.put("name", UNSPECIFIED);
|
||||
unspecifiedEnum.put("isString", "false");
|
||||
unspecifiedEnum.put("value", "\"" + UNSPECIFIED + "\"");
|
||||
enumVars.add(0, unspecifiedEnum);
|
||||
}
|
||||
}
|
||||
|
||||
if (allowableValues.containsKey("values")) {
|
||||
List<String> values = (List<String>) allowableValues.get("values");
|
||||
if (!values.contains(UNSPECIFIED)) {
|
||||
List<String> modifiableValues = new ArrayList<>(values);
|
||||
modifiableValues.add(0, "UNSPECIFIED");
|
||||
modifiableValues.add(0, UNSPECIFIED);
|
||||
allowableValues.put("values", modifiableValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates enum vars and puts index to them
|
||||
|
@ -450,7 +450,15 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers);
|
||||
|
||||
String underscoredOperationId = underscore(op.operationId);
|
||||
ArrayList<MethodOperation> pathMethods = pathMethodOpMap.get(path);
|
||||
String axumPath = op.path;
|
||||
for (CodegenParameter param : op.pathParams) {
|
||||
// Replace {baseName} with {paramName} for format string
|
||||
String paramSearch = "{" + param.baseName + "}";
|
||||
String paramReplace = "{" + param.paramName + "}";
|
||||
|
||||
axumPath = axumPath.replace(paramSearch, paramReplace);
|
||||
}
|
||||
ArrayList<MethodOperation> pathMethods = pathMethodOpMap.get(axumPath);
|
||||
|
||||
// Prevent multiple declarations of the same operation
|
||||
if (pathMethods != null && pathMethods.stream().anyMatch(pathMethod ->
|
||||
@ -463,14 +471,6 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
|
||||
if (!op.isCallbackRequest) {
|
||||
// group route by path
|
||||
String axumPath = op.path;
|
||||
for (CodegenParameter param : op.pathParams) {
|
||||
// Replace {baseName} with {paramName} for format string
|
||||
String paramSearch = "{" + param.baseName + "}";
|
||||
String paramReplace = "{" + param.paramName + "}";
|
||||
|
||||
axumPath = axumPath.replace(paramSearch, paramReplace);
|
||||
}
|
||||
pathMethodOpMap
|
||||
.computeIfAbsent(axumPath, (key) -> new ArrayList<>())
|
||||
.add(new MethodOperation(
|
||||
|
@ -708,9 +708,9 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
}
|
||||
}
|
||||
|
||||
// If we use a file parameter, we need to include the imports and crates for it
|
||||
// If we use a file body parameter, we need to include the imports and crates for it
|
||||
// But they should be added only once per file
|
||||
for (var param: operation.allParams) {
|
||||
for (var param: operation.bodyParams) {
|
||||
if (param.isFile && supportAsync && !useAsyncFileStream) {
|
||||
useAsyncFileStream = true;
|
||||
additionalProperties.put("useAsyncFileStream", Boolean.TRUE);
|
||||
|
@ -188,6 +188,12 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
updateOption(CodegenConstants.API_PACKAGE, apiPackage);
|
||||
updateOption(CodegenConstants.MODEL_PACKAGE, modelPackage);
|
||||
|
||||
// Enable discriminator-based oneOf interface generation by default
|
||||
useOneOfInterfaces = true;
|
||||
legacyDiscriminatorBehavior = false;
|
||||
updateOption(USE_ONE_OF_INTERFACES, String.valueOf(useOneOfInterfaces));
|
||||
updateOption(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, String.valueOf(legacyDiscriminatorBehavior));
|
||||
|
||||
apiTestTemplateFiles.clear(); // TODO: add test template
|
||||
|
||||
// spring uses the jackson lib
|
||||
@ -365,9 +371,6 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
|
||||
convertPropertyToTypeAndWriteBack(REQUEST_MAPPING_OPTION, RequestMappingMode::valueOf, this::setRequestMappingMode);
|
||||
|
||||
useOneOfInterfaces = true;
|
||||
legacyDiscriminatorBehavior = false;
|
||||
|
||||
// Please refrain from updating values of Config Options after super.ProcessOpts() is called
|
||||
super.processOpts();
|
||||
|
||||
@ -1036,6 +1039,12 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
codegenOperation.imports.addAll(provideArgsClassSet);
|
||||
}
|
||||
|
||||
// to prevent inheritors (JavaCamelServerCodegen etc.) mistakenly use it
|
||||
if (getName().contains("spring")) {
|
||||
codegenOperation.allParams.stream().filter(CodegenParameter::notRequiredOrIsNullable).findAny()
|
||||
.ifPresent(p -> codegenOperation.imports.add("Nullable"));
|
||||
}
|
||||
|
||||
if (reactive) {
|
||||
if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) {
|
||||
codegenOperation.imports.add("ApiIgnore");
|
||||
|
@ -1342,7 +1342,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
System.out.println("# swift5 generator is contributed by Bruno Coelho (https://github.com/4brunu). #");
|
||||
System.out.println("# Please support his work directly via https://paypal.com/paypalme/4brunu \uD83D\uDE4F #");
|
||||
System.out.println("# #");
|
||||
System.out.println("# There is a new swift6 generator, that is currently in beta. #");
|
||||
System.out.println("# There is a new swift6 generator, that is now stable. #");
|
||||
System.out.println("# Try it and give us your feedback. #");
|
||||
System.out.println("# https://openapi-generator.tech/docs/generators/swift6 #");
|
||||
System.out.println("# #");
|
||||
|
@ -142,7 +142,7 @@ public class Swift6ClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
this.useOneOfInterfaces = true;
|
||||
|
||||
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
|
||||
.stability(Stability.BETA)
|
||||
.stability(Stability.STABLE)
|
||||
.build();
|
||||
|
||||
outputFolder = "generated-code" + File.separator + "swift";
|
||||
|
@ -559,7 +559,9 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
// additionalProperties explicitly set to false
|
||||
if (schema.getAdditionalProperties() instanceof Boolean && Boolean.FALSE.equals(schema.getAdditionalProperties())) {
|
||||
if ((schema.getAdditionalProperties() instanceof Boolean && Boolean.FALSE.equals(schema.getAdditionalProperties())) ||
|
||||
(schema.getAdditionalProperties() instanceof Schema && Boolean.FALSE.equals(((Schema) schema.getAdditionalProperties()).getBooleanSchemaValue()))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -808,7 +810,13 @@ public class ModelUtils {
|
||||
(null != schema.getProperties() && !schema.getProperties().isEmpty()) &&
|
||||
// no additionalProperties is set
|
||||
(schema.getAdditionalProperties() == null ||
|
||||
(schema.getAdditionalProperties() instanceof Boolean && !(Boolean) schema.getAdditionalProperties()));
|
||||
// additionalProperties is boolean and set to false
|
||||
(schema.getAdditionalProperties() instanceof Boolean && !(Boolean) schema.getAdditionalProperties()) ||
|
||||
// additionalProperties is a schema with its boolean value set to false
|
||||
(schema.getAdditionalProperties() instanceof Schema &&
|
||||
((Schema) schema.getAdditionalProperties()).getBooleanSchemaValue() != null &&
|
||||
!((Schema) schema.getAdditionalProperties()).getBooleanSchemaValue())
|
||||
);
|
||||
}
|
||||
|
||||
public static boolean hasValidation(Schema sc) {
|
||||
@ -1565,6 +1573,7 @@ public class ModelUtils {
|
||||
List<String> refedWithoutDiscriminator = new ArrayList<>();
|
||||
|
||||
if (interfaces != null && !interfaces.isEmpty()) {
|
||||
List<String> parentNameCandidates = new ArrayList<>(interfaces.size());
|
||||
for (Schema schema : interfaces) {
|
||||
// get the actual schema
|
||||
if (StringUtils.isNotEmpty(schema.get$ref())) {
|
||||
@ -1572,10 +1581,10 @@ public class ModelUtils {
|
||||
Schema s = allSchemas.get(parentName);
|
||||
if (s == null) {
|
||||
LOGGER.error("Failed to obtain schema from {}", parentName);
|
||||
return "UNKNOWN_PARENT_NAME";
|
||||
parentNameCandidates.add("UNKNOWN_PARENT_NAME");
|
||||
} else if (hasOrInheritsDiscriminator(s, allSchemas, new ArrayList<Schema>())) {
|
||||
// discriminator.propertyName is used or x-parent is used
|
||||
return parentName;
|
||||
parentNameCandidates.add(parentName);
|
||||
} else {
|
||||
// not a parent since discriminator.propertyName or x-parent is not set
|
||||
hasAmbiguousParents = true;
|
||||
@ -1592,6 +1601,12 @@ public class ModelUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (parentNameCandidates.size() > 1) {
|
||||
// unclear which one should be the parent
|
||||
return null;
|
||||
} else if (parentNameCandidates.size() == 1) {
|
||||
return parentNameCandidates.get(0);
|
||||
}
|
||||
if (refedWithoutDiscriminator.size() == 1 && nullSchemaChildrenCount == 1) {
|
||||
// One schema is a $ref and the other is the 'null' type, so the parent is obvious.
|
||||
// In this particular case there is no need to specify a discriminator.
|
||||
@ -1926,7 +1941,7 @@ public class ModelUtils {
|
||||
if (multipleOf != null) target.setMultipleOf(multipleOf);
|
||||
if (minimum != null) {
|
||||
if (isIntegerSchema(schema)) {
|
||||
target.setMinimum(String.valueOf(minimum.longValue()));
|
||||
target.setMinimum(String.valueOf(minimum.toBigInteger()));
|
||||
} else {
|
||||
target.setMinimum(String.valueOf(minimum));
|
||||
}
|
||||
@ -1934,7 +1949,7 @@ public class ModelUtils {
|
||||
}
|
||||
if (maximum != null) {
|
||||
if (isIntegerSchema(schema)) {
|
||||
target.setMaximum(String.valueOf(maximum.longValue()));
|
||||
target.setMaximum(String.valueOf(maximum.toBigInteger()));
|
||||
} else {
|
||||
target.setMaximum(String.valueOf(maximum));
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
import java.util.Locale;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
|
||||
@ -694,6 +695,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
if (serverIndex != null) {
|
||||
if (serverIndex < 0 || serverIndex >= servers.size()) {
|
||||
throw new ArrayIndexOutOfBoundsException(String.format(
|
||||
Locale.ROOT,
|
||||
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
|
||||
));
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* If the field is required, always include it, even if it is null.
|
||||
* Else use custom behaviour, IOW use whatever is defined on the object mapper
|
||||
}}
|
||||
@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}})
|
||||
@JsonProperty(value = JSON_PROPERTY_{{nameInSnakeCase}}, required = {{#isNullable}}false{{/isNullable}}{{^isNullable}}{{required}}{{/isNullable}})
|
||||
@JsonInclude({{#isMap}}{{#items.isNullable}}content = JsonInclude.Include.ALWAYS, {{/items.isNullable}}{{/isMap}}value = JsonInclude.Include.{{#required}}ALWAYS{{/required}}{{^required}}USE_DEFAULTS{{/required}})
|
||||
{{#withXml}}
|
||||
@JacksonXmlProperty(localName = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#isXmlAttribute}}, isAttribute = true{{/isXmlAttribute}}{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}})
|
||||
|
@ -50,6 +50,7 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.TimeZone;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -929,6 +930,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
if (serverIndex != null) {
|
||||
if (serverIndex < 0 || serverIndex >= servers.size()) {
|
||||
throw new ArrayIndexOutOfBoundsException(String.format(
|
||||
Locale.ROOT,
|
||||
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
|
||||
));
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
@ -115,7 +116,7 @@ public class {{classname}} extends BaseApi {
|
||||
localVarQueryParameterBaseName = "{{{baseName}}}";
|
||||
{{#isArray}}
|
||||
for (int i=0; i < {{paramName}}.size(); i++) {
|
||||
localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format("{{baseName}}[%d]", i)));
|
||||
localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format(Locale.ROOT, "{{baseName}}[%d]", i)));
|
||||
}
|
||||
{{/isArray}}
|
||||
{{^isArray}}
|
||||
|
@ -4,6 +4,7 @@ package {{invokerPackage}}.auth;
|
||||
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ApiKeyAuth implements RequestInterceptor {
|
||||
private final String location;
|
||||
@ -39,7 +40,7 @@ public class ApiKeyAuth implements RequestInterceptor {
|
||||
} else if ("header".equals(location)) {
|
||||
template.header(paramName, apiKey);
|
||||
} else if ("cookie".equals(location)) {
|
||||
template.header("Cookie", String.format("%s=%s", paramName, apiKey));
|
||||
template.header("Cookie", String.format(Locale.ROOT, "%s=%s", paramName, apiKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
{{/models}}
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
{{#imports}}
|
||||
import {{import}};
|
||||
{{/imports}}
|
||||
|
@ -366,8 +366,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
int i = 0;
|
||||
for ({{items.dataType}} _item : {{getter}}()) {
|
||||
try {
|
||||
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
|
||||
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
|
||||
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Should never happen, UTF-8 is always supported
|
||||
@ -381,8 +381,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
if ({{getter}}() != null) {
|
||||
for (int i = 0; i < {{getter}}().size(); i++) {
|
||||
try {
|
||||
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
|
||||
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
|
||||
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Should never happen, UTF-8 is always supported
|
||||
@ -399,8 +399,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
int i = 0;
|
||||
for ({{items.dataType}} _item : {{getter}}()) {
|
||||
if (_item != null) {
|
||||
joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
|
||||
joiner.add(_item.toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
|
||||
}
|
||||
}
|
||||
i++;
|
||||
@ -410,8 +410,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
if ({{getter}}() != null) {
|
||||
for (int i = 0; i < {{getter}}().size(); i++) {
|
||||
if ({{getter}}().get(i) != null) {
|
||||
joiner.add({{getter}}().get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
|
||||
joiner.add({{getter}}().get(i).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -424,8 +424,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
for ({{items.dataType}} _item : {{getter}}()) {
|
||||
if (_item != null) {
|
||||
try {
|
||||
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
|
||||
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
|
||||
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Should never happen, UTF-8 is always supported
|
||||
@ -441,8 +441,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
for (int i = 0; i < {{getter}}().size(); i++) {
|
||||
if ({{getter}}().get(i) != null) {
|
||||
try {
|
||||
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
|
||||
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
|
||||
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Should never happen, UTF-8 is always supported
|
||||
@ -461,8 +461,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
if ({{getter}}() != null) {
|
||||
for (String _key : {{getter}}().keySet()) {
|
||||
try {
|
||||
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
|
||||
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix),
|
||||
{{getter}}().get(_key), URLEncoder.encode(String.valueOf({{getter}}().get(_key)), "UTF-8").replaceAll("\\+", "%20")));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Should never happen, UTF-8 is always supported
|
||||
@ -475,8 +475,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
if ({{getter}}() != null) {
|
||||
for (String _key : {{getter}}().keySet()) {
|
||||
if ({{getter}}().get(_key) != null) {
|
||||
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix))));
|
||||
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
|
||||
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -486,7 +486,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#isPrimitiveType}}
|
||||
if ({{getter}}() != null) {
|
||||
try {
|
||||
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
|
||||
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Should never happen, UTF-8 is always supported
|
||||
throw new RuntimeException(e);
|
||||
@ -502,7 +502,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{^isModel}}
|
||||
if ({{getter}}() != null) {
|
||||
try {
|
||||
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
|
||||
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Should never happen, UTF-8 is always supported
|
||||
throw new RuntimeException(e);
|
||||
|
@ -54,6 +54,7 @@ import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
{{#jsr310}}
|
||||
@ -1223,6 +1224,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
if (index < 0 || index >= serverConfigurations.size()) {
|
||||
throw new ArrayIndexOutOfBoundsException(
|
||||
String.format(
|
||||
Locale.ROOT,
|
||||
"Invalid index %d when selecting the host settings. Must be less than %d",
|
||||
index, serverConfigurations.size()));
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
|
||||
{{/anyOf}}
|
||||
{{/composedSchemas}}
|
||||
throw new IOException(String.format("Failed deserialization for {{classname}}: no match found"));
|
||||
throw new IOException("Failed deserialization for {{classname}}: no match found");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import java.util.Objects;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
{{#imports}}
|
||||
import {{import}};
|
||||
{{/imports}}
|
||||
|
@ -6,6 +6,7 @@ import java.util.logging.Logger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
@ -70,7 +71,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
return new{{classname}};
|
||||
{{/mappedModels}}
|
||||
default:
|
||||
log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue));
|
||||
log.log(Level.WARNING, String.format(Locale.ROOT, "Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue));
|
||||
}
|
||||
|
||||
{{/discriminator}}
|
||||
@ -157,7 +158,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
ret.setActualInstance(deserialized);
|
||||
return ret;
|
||||
}
|
||||
throw new IOException(String.format("Failed deserialization for {{classname}}: %d classes match result, expected 1", match));
|
||||
throw new IOException(String.format(Locale.ROOT, "Failed deserialization for {{classname}}: %d classes match result, expected 1", match));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user