14717 Commits

Author SHA1 Message Date
GregDThomas
ec28d6261c
Fix #21921 by marking required path parameters as @NotNull (#21951) 2025-09-13 17:48:47 +08:00
Leon Linhart
0edcc9d204
Correctly annotate Gradle task in- & outputs and enable stricter plugin validation (#21957)
* Correctly apply Gradle task input & output annotations to accessors

Gradle's task input and output annotations should be applied to the accessors instead of the properties. No adhering to this can cause funky behavior in the generated stubs. Examples of this can be found in the docs: https://docs.gradle.org/current/userguide/implementing_custom_tasks.html

Also adds missing annotations so that validation passes

* Enable strict Gradle plugin validation
2025-09-13 16:49:06 +08:00
MarcoZurich
59eac42b0f
Fix "defaultToEmptyContainer" not properly implemented for non-nullable, required Map (#21953)
* Issue 21890: Fixed flag to use for check of required, non-nullable map

* Issue 21890: added test (first draft)

* Issue 21890: Added Test

---------

Co-authored-by: Marco <chorizoparatodos@gmail.com>
2025-09-13 16:47:45 +08:00
William Cheng
5efe16c66b
[java] Update rest-assured dependencies to newer versions (#21961)
* update rest-assured dep to newer versions

* update build
2025-09-13 16:32:31 +08:00
William Cheng
177b94b1b4
Add tests for numeric form data (kotlin - jvm-ktor) (#21952)
* add tests for numeric form data (kotlin)

* remove null check as its done already
2025-09-12 15:28:57 +08:00
Jef LeCompte
58fde20e2c
fix: parameter appending for number types (#21947)
* fix: parameter appending for number types

Updated string and number parameter handling to ensure proper conversion to string before appending.

* Update api.mustache
2025-09-12 13:10:40 +08:00
Maik Dijkstra
9b692e5ef7
fix(ruby-client): Fix incorrect boolean parsing in OneOf/AnyOf (#21943)
Changes the logic of parsing of OneOf/AnyOf to fix incorrect type coercion
in OneOf/AnyOf contexts. The guard which checks whether typed_data is true-ish
fails for booleans. If the oneOf includes a boolean type and the data is false then
it will correctly parse this value as a boolean. However, the guard class will determine
that false is not true-ish and therefore returns nil. So the result of the type coercion
of false will be nil. This can result in problems when dealing with default true.

For example how a false can turn into a true with defaults:
1. The API returns false
2. The type coercion determines false becomes nil
3. When storing this retrieved record with a default of true for this column the stored value is suddenly true
while the API specifically returned false

This fix removes this guard and will rely on the exception raised to return nil when type coercion fails.
2025-09-11 20:46:06 +08:00
Knut Erik Langdahl
d523903827
fix(kotlin): set isVoid to true for Unit datatypes (#21940) 2025-09-11 20:17:05 +08:00
Artem ILIN
5f647b8477
[python] fixes #21936, api client type checks (#21935) 2025-09-11 00:04:48 +08:00
Pascal Bachor
6825d9ccaa
python: feature flag for lazy imports (#21885)
* python: feature flag for lazy imports

* python: update samples

* python: add python-lazyImports to test job

* python: reuse tests in lazyImports sample

* python: avoid using non-imported submodules

* add normalizer option

---------

Co-authored-by: Pascal Bachor <bachorp@users.noreply.github.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
2025-09-10 17:22:41 +08:00
keepConcentration
0e42edc95b
[#21619] fix(python): update pyproject.toml license format with poetry1 fallback (#21931)
* Add support for both string and object license formats in `pyproject.toml` for Python and Python-Pydantic generators. (#21619)

* Generate the samples (#21698)

* Generate the samples (#21698)

* Remove Python-Pydantic-v1 license format tests (#21619)

* Revert license format to string in Python-Pydantic-v1 samples (#21619)
2025-09-10 15:35:10 +08:00
Ruben Hönle
278d7ae4c9
java-client: fix some javadoc comments (#21932)
* java-client: fix some javadoc comments

* update samples
2025-09-10 01:44:36 +08:00
William Cheng
7b3de8dbce
[python] fix default value when enum is a reference (#21923)
* fix default value when enum is ref (python)

* update spec
2025-09-09 09:21:09 +08:00
William Cheng
6e089f5f03
Support normalizing anyof/oneof enum constraints to a single enum (#21917)
* Support normalizing anyof/oneof enum constraints to a single enum

* Add SIMPLIFY_ONEOF_ANYOF_ENUM to the documentation

* Process referenced schemas with oneof/enum as well

* Implement referenced enum merging from oneof/anyof

* Implement retaining the enum description as x-enum-desriptions for oneof enum

* Update samples and docs with oneOf enum normalization

* update samples to fix python tests

* fix test file name

* fix incorrect filename

---------

Co-authored-by: Pieter Bos <pieter.bos@nedap.com>
2025-09-07 17:36:02 +08:00
Tim Van Wassenhove
ee40887d47
fix(rust): Add anyOf support to Rust client generator (#21896)
* feat(rust): Add anyOf support to Rust client generator

This commit adds support for anyOf schemas in the Rust client generator
by treating them similarly to oneOf schemas, generating untagged enums
instead of empty structs.

The implementation reuses the existing oneOf logic since Rust's serde
untagged enum will deserialize to the first matching variant, which
aligns well with anyOf semantics where one or more schemas must match.

Fixes the issue where anyOf schemas would generate empty unusable structs.

* test(rust): Add test for anyOf support

This commit adds a test case to verify that anyOf schemas generate
proper untagged enums instead of empty structs in the Rust client
generator.

The test includes:
- A test OpenAPI spec with anyOf schemas
- Unit test that verifies the generated code structure
- Assertions to ensure enums are created instead of empty structs

* Fix anyOf support for Rust generator

- Fixed template closing tag issue that prevented anyOf schemas from generating enums
- Changed {{/composedSchemas.oneOf}} to {{/composedSchemas}} at line 262
- Put #[serde(untagged)] and pub enum on same line for test compatibility
- Fixed TestUtils.linearize() method replacing spaces with literal '\s' string

The Rust generator already converts anyOf to oneOf for processing, but the
template wasn't correctly handling these converted schemas. Now anyOf schemas
generate proper untagged enums, matching the expected behavior for oneOf
schemas without discriminators.

* fix(rust): maintain multi-line formatting for serde attributes in oneOf/anyOf enums

- Keep #[serde(untagged)] on separate line from pub enum for better readability
- Update test assertions to use two separate checks instead of linearize()
- Ensures generated Rust code maintains consistent formatting with existing samples
- Preserves the original multi-line attribute style preferred in Rust ecosystem
2025-09-06 18:46:24 +08:00
William Cheng
1d739f1598
New generator for Scala3 + sttp4 + jsoniter-scala (#21908)
* started impl

* seems to work

* generated docs

* fix class name duplicates on case-insensitive filesystems

* wip

* added script to rebuild all projects

* dropped bash slop

* fixed directory structure

* ok, now it makes sense

* update sttp, serialize query params, fix enums serialization, fix not required files params

* fix compile errors after sttp upgrade, fix missing enum import in operations, fix file response. change serialization from Map to Seq to avoid deleting duplicate keys

* auth support

* fix enums entries, multipart support(partially), header, path and cookie serialization support

* support of option fields

* add samples, update workflow

* add new files

* fix

* remove tab

* remove tab

* update doc

* update header

* update readme

---------

Co-authored-by: Łukasz Biały <lukasz.marcin.bialy@gmail.com>
Co-authored-by: Kamil-Lontkowski <kamillont14@gmail.com>
2025-09-06 13:36:44 +08:00
yzaoui
2a556ff24e
Fix missing @Serializable on enums for kotlin/jvm-retrofit2 (#21907)
* Add @Serializable annotation to enum for kotlinx-serialization

* Adjust template, generate samples

* Fix template
2025-09-06 10:17:28 +08:00
Jens Fischer
29a817afdb
[kotlin-client] Fix string comparison in discriminator post-processing (#21881)
We encountered occassional build failures with the logic introduced in #21531 due to discriminator properties still being generated in rare cases.
Not sure why it didn't happen consistently, may be related to Gradle caching or parallel builds or whatever.
Since patching these string comparisons, this has no longer occurred.
2025-09-06 09:46:37 +08:00
Sebastian Rühl
08733aaf25
feat(golang): support for wrapped and xml name (#21899)
* feat(golang): support for wrapped and xml name

* test(golang): add two test cases for wrapped

- with name
- without name

* chore(golang): update samples
2025-09-05 01:14:14 +08:00
Kevin Liddle
86f107047e
[BUG][rust-axum] Fix duplicate route operations when supplying multiple tags on a path with a camelCase param (#21873)
* [BUG][rust-axum] Fix duplicate route operations when supplying multiple tags on a path with a camelCase param

* Update rust-axum sample
2025-09-04 01:36:26 +08:00
Julius
2ebda09b9f
feat: add support for minimal update option in maven plugin (#21872) 2025-09-04 01:00:00 +08:00
Mattias Sehlstedt
fde017150e
[C#] Fixes array TypeDeclaration parsing order to fix deep aliases (#21600)
* Adjust array TypeDeclaration parsing order to fix deep inline aliases

* Update samples
2025-09-04 00:58:13 +08:00
dsteeley
5daef3e901
fix: Resolve issue21805 rust-server compilation failure with large maximums by handling minimum and maximum using BigInt instead of longValue. (#21875) 2025-09-03 16:45:02 +08:00
William Cheng
6e443f1354
fix: honor required fields in jackson @JsonProperty annotations (#21876)
* fix: honor required fields in jackson @JsonProperty annotations

* add samples

* fix: trigger build

* fix: undo

* update to handle nullable as well

---------

Co-authored-by: Erik Lagerholm <erik.lagerholm@volvocars.com>
2025-09-03 16:41:59 +08:00
Jochen Schalanda
babb3e272b
[Java] Add missing Locale to String.format() invocations (#21871)
* [Java] Add missing Locale to String.format() invocations

* chore: ./bin/generate-samples.sh ./bin/configs/*.yaml
2025-09-03 14:52:49 +08:00
Jochen Schalanda
d1df75c61d
[Java] Remove unnecessary String.format from jersey2, jersey3, native (#21870) 2025-09-03 14:17:49 +08:00
William Cheng
20d5126b17
disable tests due to too many false alarams (#21865) 2025-09-02 16:21:10 +08:00
fkellner
efd06f5719
Fix bug in ModelUtils.getParentName resulting in wrong inner Models for oneOf-composed schemas (#21799)
* Test Cases for more than two oneOf-Options (both passing, but important to narrow down observed bug)

* fix language-specific tests broken by adding a third fruit to oneOf test

* create reproducer unit test for java client codegen

* fix typo in test yaml

* fix ModelUtils.getParentName returning name of first element in composed schema instead of null when there are multiple elements and it is not clear which one should be parent

* rename test yaml and added tests for clarity

* update samples

* update samples again
2025-09-02 15:26:26 +08:00
Leo Gomes @Amadeus
c854a23682
[protobuf] fix generation of enums with UNSPECIFIED values (#21774) 2025-09-02 12:42:27 +08:00
Eduardo Menges Mattje
27d3c6f326
[3.1] Fixed lack of check for booleanSchemaValue (#21742)
* [3.1] Fixed lack of check for ´booleanSchemaValue`

* [3.1] Fixed `isMapSchema`
2025-09-01 14:06:27 +08:00
William Cheng
90d6af2bab
Refactor Rust github workflow for clients and servers (#21851)
* add workflow to test rust clients

* update to use localhost

* rename rust server workflow
2025-09-01 11:43:25 +08:00
CatBraaain
d8593ef6d7
style: add a space before comment text in .gitignore (#21844) 2025-08-31 22:35:54 +08:00
Bruno Coelho
9148db26fc
[Swift6][client]Make Swift 6 generator stable (#21846)
* Make Swift 6 generator stable

* Make Swift 6 generator stable
2025-08-31 10:08:17 +08:00
Yasuhiro SHIMIZU
2cdd9ae687
Kotlin Multiplatform polymorphism with custom discriminator support (#21772)
* Enable descriminator for kotlin-client multiplatform

* update template

* add sample

* update samples-kotlin-client workflow

* add missing JsonClassDiscriminator import

* fix gradlew permission

* update sample

* fix sample

* re-generate sample
2025-08-31 02:22:12 +08:00
Thomas Ville
9c1b680fdf
[rust] enable useAsyncFileStream only for files in the body (#21839)
Co-authored-by: Thomas Ville <thomas.ville@aerys.in>
2025-08-29 21:02:45 +08:00
Kristian Nedrevold
bd0b81d26d
Update baseClient.mustache for scala-http4s (#21825)
The code for setting the form body parameters were wrong,

e.g. the key value pair (id, 12345) would be encoded as
id=%28id%2C12345%29

This commit adds a fix to the base client to correctly setting formBody values the previous pair will now be encoded as

id=12345
2025-08-29 13:55:06 +08:00
Paul Parenko
daa8eb422d
import Nullable if required (#21829)
Also allows to override it eg with: <importMapping>Nullable=org.jspecify.annotations.Nullable</importMapping>
2025-08-28 15:48:12 +08:00
florentausha
e4c9eb36e9
fix PHP: Fixed typing of offsetGet/offsetSet (#21583) 2025-08-28 15:46:44 +08:00
Elias Kotlyar
992e387e27
Update ApiPass.mustache (#21808)
-> added void type
2025-08-28 14:05:02 +08:00
Linh Tran Tuan
7c4d7277b4
Separate Basic Authorization into new template file (#21828) 2025-08-28 13:00:06 +08:00
Nikos Atlas
065eceb824
[Typescript] add missing typeRoots config on tsconfig (#21824)
* add missing typeRoots config on tsconfig

* add samples

* Apply suggestion from @macjohnny

Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>

* update samples

---------

Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>
2025-08-27 13:28:03 +02:00
Daniel Genchev
8ce639ddae
[kotlin-client][kotlin-spring] Fix duplicate discriminator serialization with Jackson used as serialization library (#21734)
* [kotlin-client][kotlin-spring] Fix duplicate discriminator serialization with Jackson used as serialization library

* Update samples
2025-08-27 17:37:38 +08:00
Konrad Schultz
ca7e8bd932
typescript-fetch: Fix model date crash (#21821)
* typescript-fetch: Fix model date crash

Fix a runtime crash converting to json when a date or datetime is both nullable
AND required. There are 4 cases to account for:

| required | nullable | values |
|----------|----------|--------|
| f        | f        | string OR undefined |
| f        | t        | string OR null OR undefined |
| t        | f        | string |
| t        | t        | string OR null |

And importantly when required and nullable code that would crash on null was
being generated. additionally when required is false and nullable is true we
still want to allow consumers to be able to pass in `undefined` OR `null` and
pass that value to the server. Some servers treat null and undefined differently
for some operations so having that ability is pretty reasonable.

fix: https://github.com/OpenAPITools/openapi-generator/issues/21820

* Update typescript-fetch samples

./bin/generate-samples.sh ./bin/configs/*.yaml || exit
2025-08-27 11:08:54 +02:00
Yannick Pfaff
e1447bc3dc
docs(spring): fix discriminator property defaults (#21767) 2025-08-27 16:15:22 +08:00
William Cheng
c134a8adbf
Add skipCopyWith option for dart-dio (#21816)
* add skipCopyWith option for dart-dio

* update dart tests
2025-08-27 13:51:46 +08:00
Julien Debon
9c11fcf6bc
[Fix][OCaml] Incorrect encoding/decoding for required free-form objects; Odoc for record fields (#21819)
* [OCaml] Fix inconsistent oneOf primitive sample name

* [OCaml] Fix encoding/decoding for free-form required fields

* [OCaml] Change field comment to Odoc, move it after the field

As per Odoc documentation, record field documentation should be *after* the
field, not before.
See https://ocaml.github.io/odoc/odoc/odoc_for_authors.html#special_comments
type `my_record`

* [OCaml] Cleanup non-generated files for ocaml sample
2025-08-26 18:59:11 +08:00
GregDThomas
814f406472
Fix #20370 by adding an OAuth access token supplier (#21800) 2025-08-26 14:41:45 +08:00
Julien Debon
3d93cc05ec
[OCaml] Generate .ocamlformat file; format all generated OCaml files (#21809)
* [OCaml] Generate .ocamlformat file

Fixes https://github.com/OpenAPITools/openapi-generator/issues/21806

* [OCaml] Run `dune fmt` on all OCaml folders

* Don't format in Git

* Add myself for OCaml
2025-08-26 00:36:49 +08:00
Julien Debon
dc8fac21d9
[OCaml] Introduce support for oneOf/anyOf, fix default value for non-required maps (#21798)
* Add OCaml fake-petstore to test corner cases

* Prefix List functions with Stdlib as the fake petstore generates a List module

* Handle decimal and any types

* Indent to_json.mustache for easier maintenance

* Indent api-impl.mustache a bit more for readability before fix

* Fix: do not call `to_json` for free forms and byte arrays

Fixes https://github.com/OpenAPITools/openapi-generator/issues/21312

* Fix compilation for binary types

The implementation may not be correct, but at least it compiles. To be checked
if someday someone actually uses it/complains.

* Indent to_string.mustache

* Add support for exploded form-style object query params

Fixes https://github.com/OpenAPITools/openapi-generator/issues/21307

* Add ocaml-fake-petstore to CI

* Fix free-form body params

* Cohttp_lwt.Response is deprecated, use Cohttp.Response instead

* Safe Java code cleanup

* Split into model-record.mustache

* Add some support for oneOf/anyOf

* Re-generate all OCaml samples

* Fix: correctly mark non-required maps with default empty list

* Fix: Correctly encode/decode maps

* Refresh documentation

* Refresh after merging master
2025-08-25 17:27:27 +08:00
Oliver Kuntze
cd7fe341d3
Fix validation constraints for parameters in request body of form request are not generated (at least with Spring Boot generator) (#21749)
* fix(Spring Boot): adds validation to body params of forms requests

* fix(Spring Boot): adds test for validation of body params of forms requests

* fix(Spring Boot): adds samples
2025-08-23 15:58:46 +08:00