221 Commits

Author SHA1 Message Date
Mattias Sehlstedt
1eee6038df
Fixes so that a oneOf schema with a single sub-schema is simplified (#21043)
* Fixes so that a oneOf schema with a single sub-schema is simplified when SIMPLIFY_ONEOF_ANYOF is set to true

* Adjusts oneOf_array test to ensure that it is generated as an interface instead of being simplified

* Update ruby samples so that they no longer refer to a model that is now gone due to the schema being simplified
2025-04-26 22:53:21 +08:00
Michael Düsterhus
27a705efd5
[fix][java]Add missing generated annotation to Authentication.mustache (#21125)
* Add generated annotation to Authentication.mustache

* Update Authentication.mustache jersey2

* Update Authentication.mustache jersey3

* Update Authentication.mustache okhttp

* Update Authentication.mustache restclient

* Update Authentication.mustache resttemplate

* Update Authentication.mustache vertx

* Update Authentication.mustache webclient

* doc: regenerate samples
2025-04-25 16:35:51 +08:00
jheyens
e767496357
Jersey2: Move setting of authentication parameters before generating target URL to consider API keys in URL parameters (#20688)
* Move setting of authentication parameters before generating target URL to consider API keys in URL parameters

* Regenerate Jersey2/3 examples
2025-04-23 16:04:26 +08:00
jheyens
a66dd20783
Jersey2: Do not reinitialize ClientConfig with default values when building HTTP Client (#20687)
* Do not reinitialize ClientConfig with default values when building HTTP Client

* Regenerate Jersey2/3 examples
2025-04-23 15:24:22 +08:00
Kevin Lin
b844d8d4cd
[Java] ApiClient: support deserializing from InputStream instead of String to bypass 2GB Java String limit (#21115)
* ApiClient: support deserializing JSON from InputStream instead of String to bypass 2GB Java String limit

* Update test_file_list.yaml
2025-04-23 14:59:02 +08:00
Nicolas Vervelle
8ca3543436
Issue 20804: Add java nullability annotations (#20806)
* issue-20804: Add nullability annotations to Java generated clients

Motivation:
Be able to use generated clients in code checked by tools like NullAway.

* issue-20804: Add nullability annotations to Java generated clients

Motivation:
Be able to use generated clients in code checked by tools like NullAway.

* issue-20804: Add nullability annotations to Java generated clients

Motivation:
Be able to use generated clients in code checked by tools like NullAway.
2025-03-25 23:01:17 +08:00
kenji yoshida
7d977b63dc
Update scala version (#20953) 2025-03-24 13:55:46 +08:00
kenji yoshida
c749919812
fix deprecated old sbt build file syntax (#20949) 2025-03-23 18:03:29 +08:00
Yobyn Roetz
191eba4afa
replace all UriComponentsBuilder.fromHttpUrl() with UriComponentsBuilder.fromUriString() because UriComponentsBuilder.fromHttpUrl will be removed in the near future. (#20893) 2025-03-16 16:04:04 +08:00
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
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
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
wandi34
fb7aa580bf
[Java][RestClient] Enable access token refresh (#20733) 2025-02-26 17:05:50 +08:00
Ron Reynolds
eb668b6a76
reuse Configuration.defaultApiClientin no-arg Api ctors and make ref volatile (fixes issue #20633) (#20635)
* 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!

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

* added missing import for ApiClient to anyof and oneof model mustaches
2025-02-19 14:47:55 +08:00
William Cheng
1fa07bf46c
Prepare 7.12.0 (#20512)
* Revert "v7.11.0 release (#20508)"

This reverts commit a7240eeefeedeefe7fc80ef22747dfc67e126324.

* prepare 7.12.0 snapshot version

* update samples

* update readme
2025-01-21 00:10:09 +08:00
martin-mfg
d87a70dd93
update sample tests, fix Java tests (#20300)
* replace removed forkMode

* remove junit runner where it's not needed

* update samples without skipping test files, but skip files named "FILES"

* revert overwriting custom tests, add custom java tests to list

* add one sample to CircleCI, fix various Java tests
2024-12-15 17:09:58 +08:00
Nicklas Wiegandt
07d19baf89
feat (#19407 JAVA SPRING WEBCLIENT): Add support for useSingleRequestParameter to Spring WebClient (#19827)
* chore (JAVA SPRING WEBCLIENT): Remove comments used for debugging

* feat (JAVA SPRING WEBCLIENT): Add support for useSingleRequestParameter to Spring WebClient

* feat (JAVA SPRING WEBCLIENT): Generate samples and docs

* fix (JAVA SPRING WEBCLIENT): Fix missing return error & Fix JDK17 action webclient useSingleRequestParameter test path

* fix (JAVA SPRING WEBCLIENT): Fix code indention

* fix (JAVA SPRING WEBCLIENT): Fix code indention again

* fix (JAVA SPRING WEBCLIENT): Update samples

* feat (JAVA SPRING WEBCLIENT): Regenerate after pull rebase
2024-12-15 15:28:38 +08:00
William Cheng
711e53a90c
[Java] Add option to fallback to legacy enum naming (#20172)
* add option to fallback legacy enum naming (java)

* fix tests
2024-11-29 17:12:12 +08:00
Benjamin Einaudi
18b01ca455
fixes(java/restclient) Force usage of custom converter (#20112)
* fixes(java/restclient) Force usage of custom converter

Insert custom converter at the beginning of the 'RestClientBuilder' converter list so as not to use default 'MappingJackson2HttpMessageConverter' 

Close #20111

* update samples

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
2024-11-19 16:15:51 +08:00
William Cheng
654f62ce3c
Prepare 7.11.0 (#20130)
* Revert "prepare 7.10.0 release (#20128)"

This reverts commit 12dfe8fe74a1515d1e69e00df9abe4128aa44160.

* update to 7.11.0-SNAPSHOT, update samples

* update docs
2024-11-18 20:15:29 +08:00
Christian Beikov
4185782ddc
[#20125] Remove unnecessary model package import to avoid ambiguous class references (#20124)
* Remove unnecessary model package import to avoid ambiguous class references

* Regenerate JSON files
2024-11-18 17:43:14 +08:00
jasonjyu
51a0bd00b7
Replaced deprecated 'summary' attribute with recommended 'caption' element (#19961) 2024-11-18 17:34:55 +08:00
DielN
216ba30172
[JAVA] Add missing dependencies in templates (#20075)
* Add commons-lang3 dependency for useReflectionEqualsHashCode

* Fix feign-no-nullable config/sample

* Add commons-lang3 dependency to jersey2

* Add & update mutiny dependency for microprofile

* Regenerate samples
2024-11-14 14:08:26 +08:00
William Cheng
6ff52c7e31
suppress the cast warning in java okhttp-gson client (#20076) 2024-11-10 17:34:40 +08:00
ksn-partisia
b627e1cc67
[Bug] [Java] Fix raw type compilation warning in ApiClient for jersey2 and jersey3 (#19966)
* Add type annotation to raw type Iterable in jersey templates

* Regenerate samples
2024-10-30 14:24:32 +08:00
Nicolas Vervelle
65b1859161
Add nullability annotations to Java generated clients (#19617)
* issue-1960: Add nullability annotations to Java generated clients

Motivations:
Have generated clients properly annotated for nullability to be able to check code using them with tools like NullAway

Modifications:
* Add nullable_var_annotations template to handle nullability annotation on vars
* Add pojo templates to use the nullability template
* Adapt tests

* issue-1960: Add nullability annotations to Java generated clients

Modifications:
* Run export_docs_generator.sh script to update samples
2024-10-16 16:14:29 +08:00
martin-mfg
b730e36937
[JAVA] fix several anyOf/oneOf problems (#19817)
* erasure duplicates

* sanitize beanValidation

* oneOf maps

* anyOf

* update samples
2024-10-10 14:50:18 +08:00
William Cheng
e2c458b9ea
Prepare 7.10.0 (#19809)
* Revert "prepare 7.9.0 release (#19808)"

This reverts commit 4145000dfebe7a9edea4555c8515383da7602458.

* prepare 7.10.0 snapshot

* update doc

* update samples
2024-10-08 11:21:54 +08:00
CaptainAye
a82475ed4e
Fix java rest client's ApiClient constructors to make sure objectMapper parameter is used in the client (#19667) (#19795) 2024-10-08 09:47:16 +08:00
William Cheng
9147e998ff
update spring web in resttemplate to 6.1.13 (#19671) 2024-09-25 17:10:39 +08:00
William Cheng
b3e72feaa9 update java samples 2024-09-18 16:14:47 +08:00
Eric Rolli
bbafeaed40
[Java Jersey] Update ApiClient.mustache Jersey doesn't allow entities in method DELETE (#19530)
* Update ApiClient.mustache

* Update ApiClient.mustache

Jersey doesn't allow request entities in method DELETE

* Update ApiClient.java

Jersey doesn't allow entities in method DELETE

* Update ApiClient.java

Jersey doesn't allow entities in method DELETE

* Update ApiClient.java

Jersey doesn't allow entities in method DELETE

* Update ApiClient.java

Jersey doesn't allow entities in method DELETE

* Update ApiClient.java

Jersey doesn't allow entities in method DELETE

* Update ApiClient.java

Jersey doesn't allow entities in method DELETE

* Update ApiClient.java

Jersey doesn't allow entities in method DELETE

* Update ApiClient.java

Jersey doesn't allow entities in method DELETE

* Update ApiClient.java

Jersey doesn't allow entities in method DELETE

* Update ApiClient.java

Jersey doesn't allow entities in method DELETE

* jersey ApiClient.mustache invoke DELETE without entity if empty

* jersey ApiClient.mustache invoke DELETE without entity if empty

* jersey ApiClient invoke DELETE without entity if empty

* jersey ApiClient invoke DELETE without entity if empty

* jersey ApiClient invoke DELETE without entity if empty

* jersey ApiClient invoke DELETE without entity if empty

* jersey ApiClient invoke DELETE without entity if empty

* jersey ApiClient invoke DELETE without entity if empty

* jersey ApiClient invoke DELETE without entity if empty

* jersey ApiClient invoke DELETE without entity if empty

* jersey ApiClient invoke DELETE without entity if empty

* jersey ApiClient invoke DELETE without entity if empty
2024-09-16 17:03:50 +08:00
Horace Li
42d98e2526
[Java Libraries] Jakarta Validation API support useJakartaEe flag (#19469)
* Jakarta Validation API support useJakartaEe flag

* Jakarta Validation API support useJakartaEe flag
2024-09-04 15:57:55 +08:00
Matteo Molinari
fb1c2f3483
[Bugfix][Java] Fixed jersey clients for multiple file upload (#19476)
* Fixed jersey3 client for multiple file upload

* Updated sample

* Fixed typo

* Fix

* Fix for jersey2
2024-09-02 17:25:54 +08:00
Eric
dfc381c22f
[Java] Add a new additional property to configure Jackson's failOnUnknownProperties (#19271)
* [Java] Add a new additional property to configure Jackson's `failOnUnknownProperties`

* Move `FAIL_ON_UNKNOWN_PROPERTIES` property to JavaClientCodegen

* Template `FAIL_ON_UNKNOWN_PROPERTIES` for other libraries beside retrofit2

* Default `failOnUnknownProperties` to false for all Java Client libraries

* Fix integration tests

Add the `failOnUnknownProperties: true` additional properties to generate the
expected mapper
2024-08-29 13:25:25 +08:00
William Cheng
91da2fd240
Prepare 7.9.0 snapshot (#19386)
* Revert "v7.8.0 release (#19385)"

This reverts commit 6bdc452f92d49dcac7ac21dfe8751c8cc4267b98.

* update samples for v7.9.0-snapshot
2024-08-19 16:14:51 +08:00
llendi
38ebf0bb4e
[Java][OkHttp-Gson] fix: free form query parameters for okhttp-gson (#19226) 2024-08-15 17:02:59 +08:00
Fei Wang
2bf2d9bb56
Include licenseInfo for all the generated java code files (#19273)
* Include license info for all the generated java code files

* Re-base generate
2024-08-14 15:13:42 +08:00
martin-mfg
58dd0305ce
[JAVA] use query parameter apikey if present (#19334)
* Fix #16362

* Update samples

* Undo formatting changes

* Revert whitespace changes in samples

* make it work

---------

Co-authored-by: Jason Boileau <jason@boileau.dk>
Co-authored-by: Jason Boileau <spraot@users.noreply.github.com>
2024-08-14 15:02:37 +08:00
Franck Arnulfo
d1b9f9284a
Fix issue https://github.com/OpenAPITools/openapi-generator/issues/19326 (#19328)
Try to fix issue https://github.com/OpenAPITools/openapi-generator/issues/19326
2024-08-12 15:26:11 +08:00
Christian Beikov
b5d5e572e0
Get rid of a bunch of Javadoc errors (#19209) 2024-07-21 18:48:18 +08:00
Nicklas Wiegandt
045f4b6067
fix (JAVA SPRING RESTCLIENT) 19137: Fix missing imports when using withXml for Spring RestClient and fix its README (#19146) 2024-07-17 17:47:33 +08:00
Nicklas Wiegandt
3dc3ee08bc
test (JAVA SPRING RESTCLIENT) Add echo tests for the Spring 6 RestClient (#19145)
* test (JAVA SPRING RESTTEMPLATE) 17571: Add echo-api multipart form single file test

* feat (JAVA SPRING RESTCLIENT) 18522: Add RestClient to README

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo all of Pet test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo body free form object response string test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo body pet test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo body pet response string test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo body string enum test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo body tag response test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo form tests

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo header test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo path test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo query tests

* feat (JAVA SPRING RESTCLIENT) 18522: Regenerasted API Clients for RestClient with fixed import indentation
2024-07-17 12:19:31 +08:00
William Cheng
5fdcd4857b
[okhttp-gson] migrate to jakarta.ws.rs (#19113)
* javax.ws.rs:javax.ws.rs-api package was renamed on maven

* update dependencies for java okhttp pom, build.sbt

* update

* update dep

---------

Co-authored-by: Andres Aguilar <andresesfm@gmail.com>
2024-07-10 17:07:54 +08:00
Clément Denis
705d853baa
Update okhttp3 to 4.12.0 for Maven projects (#19118) 2024-07-10 11:12:57 +08:00
William Cheng
20cfce0b4a
Prepare v7.8.0 (#19048)
* Revert "v7.7.0 release"

This reverts commit f3dd32385e02065ad298801ca11b8871bcb3a92a.

* prepare v7.8.0

* update readme

* update doc

* update samples
2024-07-02 16:45:53 +08:00
ksn-partisia
fa2b5750ce
[Bug] [Java] Remove raw type compilation warnings when generating using jersey2 or jersey3 (#19033)
* Add type annotations to raw types for jersey2 and jersey3 templates

* Update samples

* Add type parameters to anyof_model.mustache and oneof_model.mustache

---------

Co-authored-by: Kasper S. Nielsen <kasper.s.nielsen@secata.com>
2024-06-30 10:06:12 +08:00
Philzen
642b1a3a95
[JAVA] [SPRING] [PKMST] [MICRONAUT] XML wireformat: Fix Jackson useWrapping=false, JAXB+Jackson namespaces (#18870)
* Fix XML annotations on model properties (JavaSpring)

* generate JAXB annotations for attributes and elements

* generate wrapper annotations (JAXB and Jackson)

* use XML config from items for annotations of containers

* Add test for Jackson XML wrapper correctness

* Add additional test cases to cover all xml applications in spec

Test now covers all use cases described in
- https://web.archive.org/web/20240424203304/https://swagger.io/docs/specification/data-models/representing-xml/
- https://spec.openapis.org/oas/v3.0.0#xml-arrays

* Fix basename used instead of xmlName when items.xmlName is unset

See last example in spec: https://spec.openapis.org/oas/v3.0.0#xml-arrays

* Harmonize spacing between Annotation attribute name and value

* Refactor and group JAXB vs. Jackson XML annotations, only generate latter if enabled

This is in line with the way the class annotations in `xmlAnnotations.mustache`
are rendered – which only renders the `@Jackson`… xml annotations if
additionalProperty jackson is true.

Also reorder annotation attributes in the following order:
- localName/name
- namespace (optional)
- isAttribute/useWrapping (optional)

* Explicitly render `useWrapping = true` to @JacksonXmlElementWrapper

This was slightly inspired by @jzrebiec via PR #5371.

Wrapping is the default since Jackson 2.1 – so explicitly rendering
this will:
- make generated model work out-of-the-box in Jackson 2.0 for instance
- ensure the models still work if the local `XmlWrapper` was
  configured with `useXmlWrapper(false)`

* Move xml test spec to java resources folder (not spring specific)

* Make test class name match class-under-test

This makes discovery & cross-navigation in IDE easier.

* Add complete xml annotations test for Java generators

* Fix Java PKMST generator not generating @JacksonXmlElementWrapper

* Fix Java microprofile generator missing @JacksonXmlRootElement

* Fix Java microprofile generator not using wrapper annotations and namespaces

* Fix Java Micronaut Client creating invalid (unclosed) @XmlAttribute annotations

* Fix Micronaut Client using wrong localName for @JacksonXmlElementWrapper

* Fix Micronaut client rendering @JacksonXmlProperty annotation twice

* Make Java Micronaut render @JacksonXmlElementWrapper(useWrapping=false) for non-wrapped elements

* Fix Jackson element using `xml.name` when it should be `items.xml.name`

Closes #5989
Closes #3223
Relates to #9371

* Fix JAXB element using `baseName` instead of `xmlName` when items.xmlName is unset

* Remove XML generation debug output from templates

* Remove redundant newline between XML class annotations and class

Brings the SpringCodegen in line with other Java Codegen's

* Remove redundant newline between XML setter annotations and setter

* Fix multiline JavaDoc block indentation and format

* Simplify / condense xml annotation template into single lines

May look a bit more complex, but cuts out a lot of repetitiveness.
Also reorders annotation attributes in the following order:
- localName/name
- namespace (optional)
- isAttribute/useWrapping (optional)

* Harmonize spacing between Annotation attribute name and value

* Remove unused jackson_annotations partial

Was not referenced anywhere in java-helidon resources folder

---------

Co-authored-by: Christian Schuster <christian@dnup.de>
2024-06-15 23:02:32 +08:00