21173 Commits

Author SHA1 Message Date
sabra
f2bbb9e0a2
[java] generateClientAsBean for restclient and webclient (#20754)
* [java] generateClientAsBean for restclient and webclient

Added possibility to generate restclient and webclient as a @Component in the same fashion as resttemplate.

Fix #17885
Fix #19229

* - Samples
2025-03-05 17:50:24 +08:00
Jakob Warkotsch
efc53f5d47
[JavaScript] Avoid undefined headers with skipDefaultUserAgent enabled (#20792)
Prior to this commit, a JS client generated with skipDefaultUserAgent
enabled results in a src/ApiClient.js file that doesn't define
this.defaultHeaders. This breaks because this.defaultHeaders is later
directly passed to a superagent request which expects an object and not
undefined.

Fixes #20791.
2025-03-05 17:36:07 +08:00
Julien Debon
0f13dfedb9
[OCaml] Fix default optional list (#20789)
* Cleanup the existing model template

* `{{^isContainer}}foobar{{/isContainer}}{{^isContainer}}` is equivalent to `{{^isContainer}}foobar`
* Add indentations to make it easier to read the template. The generated code is
uglier, but it is ok since users are encouraged to reformat anyway

* Add a default value for non-required lists

Closes https://github.com/OpenAPITools/openapi-generator/issues/20777
2025-03-05 01:41:21 +08:00
lucy66hw
c96d3088c5
[protobuf-schema] Use snake_case for protobuf fields, UPPER_SNAKE_CASE for enums. (#20696)
* protobuf enum prefix use upper underscore

Add json name parameters and change parameter field name to snake case

* rerun generate-samples.sh

* Add CI test

* rebase master

---------

Co-authored-by: xil <xil@uber.com>
2025-03-04 17:18:07 +08:00
Julien Debon
90de8dcd75
[OCaml] Add key to each model field (#20766)
* Add key to each model field

Add a `[@key "someField"]` annotation to each model field, to avoid mismatches when the JSON field is not in snake_case.

Closes https://github.com/OpenAPITools/openapi-generator/issues/20765

* update ocaml samples

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
2025-03-04 16:49:27 +08:00
martin-mfg
a018c10c70
fix Maven plugin tests (#20782)
* fix maven test

* fix another maven test
2025-03-04 10:42:44 +08:00
Ron Reynolds
2cff152e2a
adding Intellij style xml and applied to all java code (#20734)
* added intellij-codestyle.xml and sample of it being applied to some java code-gen classes

* code-format changes ONLY

* few more format changes since last merge with master

* applied code-style to all java one last time
2025-03-04 01:44:48 +08:00
William Cheng
3ad5303f99 update samples 2025-03-03 19:29:07 +08:00
martin-mfg
2b8d496c80
[#19921] Add RFC 3339 compatible Jackson module for java.time types, regenerate samples (#20700)
Co-authored-by: Christian Beikov <christian.beikov@gmail.com>
2025-03-03 17:42:18 +08:00
Ron Reynolds
5cef0803b8
Java client enhanced Configuration with ApiClient Supplier (#20738)
* enhanced Configuration.mustache (thread-safe, lazy-eval, plugable factory

* removed comment in Configuration.mustache

* fresh samples
2025-03-03 13:52:10 +08:00
sandwoodK
e0b6b2bbc7
Fix nim code generation (#20752)
Same variable name declared multiple times in the same scope.
=> nim generated code does not compile.
2025-03-03 13:50:19 +08:00
Iurii Ignatko
af536f6205
Finalize [this-escape] warnings fixes in apache-httpclient (#20774) 2025-03-03 13:01:08 +08:00
Han van Venrooij
ecdd8b5442
Upgrade plexus-build-api (#20759) 2025-03-03 10:33:18 +08:00
Simone Dalcastagné
70df1170cc
fix: authorization values in Java modules (#20644) 2025-03-02 23:39:37 +08:00
Ross Sullivan
85ab65c4ca
Fixed allOf with only one model (#20716) 2025-03-02 23:33:00 +08:00
William Cheng
a79aad8420
Prepare 7.13.0 (#20758)
* Revert "v7.12.0 release"

This reverts commit 073723cb4d41187f839fbb46565d109293fa22d7.

* set version to v7.13.0-SNAPSHOT

* update samples

* update doc
2025-02-28 13:48:36 +08:00
William Cheng
afc27ef4bc
v7.12.0 release (#20757) v7.12.0 2025-02-28 12:12:26 +08:00
William Cheng
6e9a0559a8
[csharp] Set generichost as default (#20748)
* set generichost as default

* revert a java change

* comment out a java test

---------

Co-authored-by: devhl <shawnkanyer@gmail.com>
2025-02-27 18:06:27 +08:00
William Cheng
1c3eade94d
[java][spring] Add option optionalAcceptNullable to accept null values (#20746)
* add option to rollback accept null values

* update doc

* update tests
2025-02-27 17:21:51 +08:00
David Gamero
fc00a663e1
[typescript] middleware import file extension in api types (#20745)
* middleware import extension fix

* fix file extension

* remove laravel lib
2025-02-27 09:22:38 +01:00
David Gamero
b3f11963c3
[typescript] add call-time middleware support (#20430)
* add call-time middleware

* update dependencies to run on current tsc

* exclude middleware from inversify

* update samples

* update service

* space

* inversify exclude

* braces

* import in objectparamapi

* add integration test for middleware

* switch to configuration options merge

* enable options on non inversify builds

* remove unused middlware export

* remove merge strategy from inversify

* gen samples

* remove old middlware imports

* tab to space

* separate promise and observable options

* gen samples

* use allmiddleware var across inversify

* generate encode samples again

* add middleware call-order tests for default typescript build

* type refactor

* add semicolons, default replace, let to const

---------

Co-authored-by: david <david@dmba.local>
2025-02-26 11:33:21 +01:00
Mattias Sehlstedt
60bae732d3
SingleRequestParameter setter parameter construction (#20679)
* Add so that the singleRequestParameter can be constructed one parameter at a time

* Replace the lombok EqualsAndHashcode with a mustache implementation

* Remove equals and hashcode from oneRequestParameter model

* Remove the final keyword from variables in the oneRequestParameter class
2025-02-26 17:27:30 +08:00
jeremytrips
275107e3f1
Updated BaseService and service arguments in the mustache files to fix #20732 (#20736)
* Updated BaseService property

* removed unused depencies

* Add test files
2025-02-26 10:18:13 +01:00
wandi34
fb7aa580bf
[Java][RestClient] Enable access token refresh (#20733) 2025-02-26 17:05:50 +08:00
Elric Milon
481c69063d
[Rust] Fix enum variant name generation (#20689)
* Regression test for enum Name generation in oneOf

where variants would end up having the same name.

* Fix enum variant name generation

Datatypes like `Vec<foo::bar::Baz>` would end up as `Baz` instead of `VecOfBaz`
2025-02-26 16:57:43 +08:00
Michael Munch
57b1c91d17
Added support for Cookie parameters (#20729)
Co-authored-by: Michael Munch <mmu@bankdata.dk>
2025-02-26 16:52:12 +08:00
Sergey Yelin
c529b16600
Fix crash on escaped type in erlang-server handler (#20735) 2025-02-26 16:34:37 +08:00
Sergey Yelin
32573f7464
[erlang] erlang-server generator fixes (#20717)
* Improve perfomance for map updates

* Fix key authorization crash

* Update samples
2025-02-26 16:19:11 +08:00
abrevet-dev
8040e9aae9
Add openapi-normalizer rule to set tags to vendor extension (#20713) 2025-02-26 16:18:17 +08:00
Fabian Buchenberger
5581a2dd2c
[csharp][generichost] fix syslib1045, use GeneratedRegex for .net7+ (#20695)
* [csharp][generichost] fix SYSLIB1045 for ClientUtils

 * make JsonRegex private

 * on net7 and above use GeneratedRegex for JsonRegex

 * remove unused SanitizeFilename-Method

* [csharp][generichost] regenerate samples
2025-02-26 16:07:43 +08:00
micolous
30787a16fb
[Python] Add ca_cert_data parameter (#20697)
* Add `ca_cert_data` parameter to Python client.

This lets a client validate a server's CA certificate chain using a
variable/constant containing PEM (`str`) or DER (`bytes`) data, rather than
needing to reference a file on disk.

* python: Fix `ca_cert_data` on Python 3.8
2025-02-26 16:04:32 +08:00
Sander Jochems
5757def39b
Implement GetActualInstanceValue method (#20663) 2025-02-26 15:54:41 +08:00
Maksim Kosolapov
09df01501a
[kotlin][client] Explode query param properly (#20714) 2025-02-26 15:52:03 +08:00
Daniel Schreiber
5f92de4785
[typescript-angular] refactor service classes for reduced bundle sizes. (#20681)
This reduces bundle sizes of ESM bundles on the order of 20%.
2025-02-25 13:07:14 +01:00
moznion
9537a7fb46
[typescript] Prevent generating invalid enum code due to empty variable names (#20699)
* [typescript] Prevent generating invalid enum code due to empty variable names

After sanitizing all characters (e.g. multibyte characters), the enum variable name may become an empty string.
Since an empty string would cause a syntax error, this patch pads the pseudo variable name (`STRING`) to avoid that issue.

For example, given the following OpenAPI definition:

```yaml
openapi: "3.0.0"
info:
  title: Sample project
  version: '1.0'
  description: 'Sample API Check "API Key" '
  license:
    name: Apache 2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0'
paths: {}
components:
  schemas:
    Greeting:
      type: string
      enum:
        - 'こんにちは'
        - '你好'
        - '안녕하세요'
```

The current logic generates the following code for Greeting:

```typescript
export enum Greeting {
     = 'こんにちは',
    2 = '你好',
    3 = '안녕하세요'
}
```

This code is invalid. With this patch, the generated code becomes:

```typescript
export enum Greeting {
    STRING = 'こんにちは',
    STRING2 = '你好',
    STRING3 = '안녕하세요'
}
```

Signed-off-by: moznion <moznion@mail.moznion.net>

* Remove unnecessary imports

Signed-off-by: moznion <moznion@mail.moznion.net>

* Use new sanitizer for TypeScript symbol which takes wider variety characters for enum var name

Signed-off-by: moznion <moznion@mail.moznion.net>

---------

Signed-off-by: moznion <moznion@mail.moznion.net>
2025-02-25 12:58:27 +01:00
William Cheng
a06a2b4c7b update samples 2025-02-23 20:55:18 +08:00
Gus Costa
a56d032edf
docs(nodejs-express-server): fix default port number in README (#20706)
Update README to correctly show 8080 as the default port instead of 3000.
This matches the actual server configuration in config.js where the
server listens on port 8080 by default.
2025-02-23 20:51:45 +08:00
William Cheng
db6709fdb3
Update readme (#20712)
* update author list

* add links to blog posts

* update
2025-02-23 18:44:16 +08:00
Ross Sullivan
670e9d7099
[rust] Fixed discriminator causing duplicate enum variants (#20711)
* Fixed discriminator

* Added testcase and updated samples
2025-02-23 17:50:04 +08:00
Ruslan Khasanshin
79145dc633
[kotlin-spring] Adds 'suspend' modifier for reactive List endpoint with useFlowForArrayReturnType = false (#16130) (#20710) 2025-02-23 17:35:08 +08:00
William Cheng
b80461373a update nodejs express server samples 2025-02-23 17:32:16 +08:00
Gus Costa
86a293e0b6
fix(nodejs-express-server): update express-openapi-validator to v4 (#20704)
Update express-openapi-validator from v3 to v4 to support Node.js versions >14.
This includes:
- Upgrade express-openapi-validator dependency in package.json
- Modify server startup code to accommodate v4 API changes
- Update controller implementation to handle breaking changes

The changes ensure compatibility with modern Node.js versions while maintaining
the generator's functionality.
2025-02-23 17:27:33 +08:00
William Cheng
cea3c5ba09 update nodejs express server samples 2025-02-22 23:15:00 +08:00
Gus Costa
f83b049fe6
fix(nodejs-express-server): remove unused axios dependency (#20707)
Remove axios from package.mustache as it's not used in the starter build.
This eliminates potential security vulnerabilities (ReDos & SSRF) from
the dependency tree without affecting functionality.
2025-02-22 23:10:46 +08:00
Ross Sullivan
28c7b9b956
[rust] fixed compiler errors for decimal types (#20708) 2025-02-22 22:58:26 +08:00
Sylvain Joubert
0ff8c46595
[Python] Fix mustache tag syntax in github worklow (#20701) 2025-02-21 17:43:17 +08:00
Ron Reynolds
13111077d4
Java client codegen cleanup (#20691)
* made Configuration.defaultApiClient volatile so that if it's changed the new value is immediately visible to all other threads

* made no-arg api ctor use Configuration.getDefaultApiClient() instead of creating new ApiClient every time

* replaced all use of URLEncoder.encode with ApiClient.urlEncode; just code cleanup; no functional changes

* disabled AbstractJavaCodegenTest.testGeneratedExampleValues as it fails, possibly due to timezone (Locale.ROOT) of local system

* replaced thread-unsafe SimpleDateFormat with DateTimeFormatter and re-enabled unit-test

* removed unused import

* ran the generate-sample scripts and generated a HUGE number of changes!

* some code cleanup and adding booleans to processOpts to remove lots of duplicate FOO.equals(getLibrary()) checks; also using isLibrary() wherever possible

* added missing import of Configuration to api.mustache (and, thus, all native samples)

* added missing import for ApiClient to anyof and oneof model mustaches

* rolled back formatting of cliOptions block (too many changes for a simple PR)

* use toLowerCase with locale

* reverted supportedLibraries reordering and format changes to reduce diff noise

* updated comment

* rolled back Slf4j change due to failing arch-unit test; also rolled back serialization-lib setting code due to unit-test failure (still a mystery)

* moved lib* booleans AFTER super.processOpts() the library can be changed (as shown by unit-test)
2025-02-20 18:16:40 +08:00
Christian Munier
73079c2ef6
Fix #20692 [typescript-angular] Support enumDescription / x-enum-descriptions (#20693)
* #20692 [typescript-angular] Added x-enum-descriptions to "composed-schemas" example.

* #20692 [typescript-angular] Respect x-enum-descriptions / enumDescription in modelEnum mustache template.

* #20692 [typescript-angular] Regenerated samples.
2025-02-20 11:04:00 +01:00
Erik VanderWerf
9374dbd030
Add option to skip merging spec files (#19396)
Introduced a new property `inputSpecRootDirectorySkipMerge` to conditionally skip the merging step of the specification files. Updated the logic to honor this new property, ensuring merging only occurs if it is explicitly not skipped. Enabled configuration via Gradle build file.
2025-02-19 17:28:03 +08:00
Jonathan Martens
890c37fd77
fix: display of markdown in notes section (#20534)
* fix: display of markdown in notes section

* update samples

* skip blank lines

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
2025-02-19 17:15:29 +08:00