106 Commits

Author SHA1 Message Date
William Cheng
3b6b55144d
fix gradle.properties in java client (#21129) 2025-04-23 17:05:04 +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
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
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
Iurii Ignatko
bc70f04848
Additional [this-escape] warnings fixes (#20515) 2025-01-22 01:05:54 +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
Iurii Ignatko
fa3e38a4b7
[JAVA] Address [rawtypes] and [this-escape] warnings in generated API clients (#20466)
* Address [rawtypes] and [this-escape] warnings in generated API clients

* Commit updated sample files
2025-01-18 15:00:16 +08:00
William Cheng
ea2ba0c349
[java][native] fix empty response body (#20334)
* [Java][Client] (#13968)

* update

* update

* update slack url

---------

Co-authored-by: András Gábor Kis <andras-gabor.kis@telekom.com>
2024-12-15 22:32:46 +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
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
William Cheng
511316a966
Test build.gradle for java native petstore samples, sync pom.xml & build.gradle (#19951)
* test build.gradle for java native petstore samples

* trigger build

* sync pom.xml and build.gradle (java native)
2024-10-23 16:38:30 +08:00
Simon
21093b78c6
[JAVA]: Fix unknown property error for gradle build (#19933)
* Replace classifier with archiveClassifier

* Regenerate samples by script
2024-10-23 15:37:46 +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
d60200de38
improve java enums (#19815) 2024-10-09 10:46:17 +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
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
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
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
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
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
Philzen
2b9949a66b
Bump Jackson to latest v2.17.1 and sync in templates (#18799)
* Drop separate version property

Not required as all Jackson packages usually tether on a version bump.

* Update Jackson to v2.17.1

* Sync Jackson version used by Spring Boot with project version

* Sync jackson update to v2.17.1 with generator templates

* Regenerate samples with updated versions

* Adjust test to current exception msg behavior

* Add dependency mgmt to ensure matching version for transitive dependencies

* Update library descriptions with correct Jackson version number

* Update library descriptions with correct GSON and JSONB versions

* Update retrofit library description with correct version number

* Update retrofit description to include Jackson as an option

This should have been done as part of in #16853.

* Update remaining libary version descriptions with correct versions

* Generate updated doc
2024-06-02 15:17:38 +08:00
Marcel Huber
74a9509e0c
[Java][native] Fix: DateTime in deepObjects is no longer serialized correctly [fix #18742] (#18743)
* fix serialization of OffsetDateTime

* update samples

* wrap import
2024-05-27 16:32:32 +08:00
Marcel Huber
728abafdfa
[Java][native] Fix: empty deepObject can produce invalid query [fix #18736] (#18737)
* fix empty query parameter string

* update samples
2024-05-26 15:54:58 +08:00
William Cheng
741bf0c035
Prepare 7.7.0-SNAPSHOT (#18709)
* Revert "7.6.0 release"

This reverts commit d76f9d32d11a03be2b40ebff728ef0ff86332fcb.

* prepare 7.7.0 snapshot in master

* update samples
2024-05-20 17:27:17 +08:00
Thorsten Hirsch
854e521a06
upgrade java native to junit5 (#18617)
* upgrade java native to junit5

* upgrade build.gradle, optimize imports

* upgrade gradle, re-generate samples

* migrate api_test.mustache and petstore tests of native-async & native-jakarta
2024-05-10 10:50:54 +08:00
Erko Risthein
bd02e65f88
[Java] Update Java version in GitHub actions (#18513)
* Update Java version in Github actions

* Generate samples

* [java] Upgrade Gradle wrapper to 8.7

* Generate samples

* [Java] Add resttemplate-jakarta to CI

* Upgrade CI machines to ubuntu-2204:2024.04.4 which use Java 21

* Change CI machines to ubuntu-2204:2024.01.1 which use Java 17

* Change CI machines to ubuntu-2004:2024.01.1

* [ruby] Update Gemfile.locks

* Use gradle wrapper for samples-java-client-jdk17
2024-04-30 13:57:01 +08:00
William Cheng
807250a430
Prepare 7.6.0 (#18412)
* Revert "v7.5.0 release"

This reverts commit 1eafe2aebf33b13bee0ead66d62a6436e7db059d.

* update master to v7.6.0 snapshot

* update readme

* update samples
2024-04-17 19:05:37 +08:00
William Cheng
eb506ee776
[java][native] use type reference instead to fix compilation issue in JDK11 (#18346)
* use type reference instead to fix compilation issue in jdk11

* fix
2024-04-10 11:29:51 +08:00
William Cheng
a651376b18 fix java native compilation errors 2024-04-10 02:57:41 +08:00
William Cheng
d6749f8a0e update samples 2024-04-09 20:49:23 +08:00
Joakim Holm
3cb3fc2898
Add Generated annotations to more classes (#17736) 2024-04-09 16:39:53 +08:00
ふぁ
5e9546451c
[Python] Add echo_api test object serialization for multipart requests (#18176)
* [python] echo add test object serialization for multipart requests

* [echo api] update samples

* [echo api] update samples
2024-03-23 21:40:10 +08:00
Flemming Nørnberg Larsen
a4508f6817
#18058 Fix the Java generator to generate valid @RequestMappings where the produce field takes list of string parameters instead of a single comma-separated string (#18092)
* #18058 Fix AbstractJavaCodegen.getAccepts() so it returns a String array instead of a comma-separated string, and fixed api.mustache so the @RequestMapping annotation generated produces for x-accepts as a parameter list instead of a (single) string.

* #18058 Updated test case to accept a string array instead of a comma-separated list.

* #18058 Reverted changes on imported compared to the main branch.

* #18058 getAccepts() is now hybrid, and can return both a single String or a String[].

* #18058 Rolled back the hybrid getAccepts(), so it only returns a String array.

* #18058 Updated mustache files to cope with vendorExtensions.x-accepts being a string array instead of a comma-separated string.

* #18058 Generated new sample files with by running `./bin/generate-samples.sh ./bin/configs/*.yaml`

* #18058 Optimization of getAccepts()

* #18058 Regenerated scripts that got broken after resolving conflicts on GitHub

* #18058 Fixed introduced issue with api.mustache causing a redundant accept with @HttpExchange with the PetApi.java, StoreApi.java, and UserApi.java.
2024-03-21 17:53:18 +08:00
William Cheng
7aeb952565 update samples 2024-03-21 11:42:51 +08:00
Dennis Melzer
96bf7ac915
Fix default empty collections when collection is optional (#18080)
* Fix optional empty collection as default

* Fix test

* Fix test
2024-03-14 20:28:27 +08:00
William Cheng
4ff7e0ec3f
Prepare 7.5.0 snapshot (#18068)
* Revert "7.4.0 release"

This reverts commit eda049348425171df772a7b9087cc97db718cfda.

* prepare 7.5.0 snapshot version

* update samples

* update doc
2024-03-11 11:10:52 +08:00
Ross Bender
cf2435f335
Add support for controlling output of OpenAPI Generator version in generated files (#17952)
* add initial openapi config and java generated files

* add java implementation for adding generator version

* regenerate sample client files

* remove tabs

* only show generated version if build info exists

* set build info for batch generation

* update generator doc for new global flag

* use existing property for generator version

* update templates to include generator version

* update templates for better generator version syntax

* revert undesired changes

* regenerate samples for openapi client

* update templates to correct formatting/newlines

* correct description text and add to usage doc

* add generator cli option for all codegen types

* use more concise version info; update existing codegens to support new prop

* correct wrong prop reference

* add initial test coverage for new prop

* update last (scala) templates with new prop

* update samples after upstream merge

* use consistent version output

* use better sample project id/name

* revert using option for generator version in templates
2024-03-09 15:52:08 +08:00
Ross Bender
22c52d358c
Update Java templates to correctly close parenthesis (#17961)
* update java templates to correctly close parenthesis

* add closing parenthesis to missing java template
2024-02-26 15:24:31 +08:00
Simon Podlipsky
1e9bccca16
feat: generate EOL in VERSION file (#17829)
The EOL is missing so let's add it in order to comply with POSIX standard:

Line
> A sequence of zero or more non- <newline> characters plus a terminating <newline> character.
2024-02-12 15:40:55 +08:00
William Cheng
783e68c7ac
7.4.0 snapshot (#17818)
* Revert "7.3.0-release (#17817)"

This reverts commit d617b46c86b9075c5e0d63fe3798e2982f5259ac.

* update samples, docs, readme
2024-02-08 16:07:22 +08:00
Jonathan
f323a3e788
[Python] deserialize enum json response (fix #17789) (#17791)
* deserialize enum json response (python)

* adapt python samples: adding enum deserialization

* add echo test for enum json response deserialization (python)

* update samples
2024-02-08 10:52:43 +08:00
Jesenko Mehmedbasic
a092bbd83b
[BUG] [Java] Remove deprecation and serial warnings in ApiException.java and JSON.java (#17716)
* Add serialVersionUID to Java apiException.mustache templates

* Use 'enable()' and 'disable()' methods to handle object mapper features in JSON.mustache for the "native" Java generator instead of the deprecated 'configure()'

* Update samples
2024-01-27 10:42:27 +08:00
William Cheng
d0187ab359
Add tests for query parameters (array of integer/string) (#17686)
* add tests for query parameters in python client

* update other samples

* update samples
2024-01-24 10:20:18 +08:00
Steven Sheehy
209344ba40
[java][native] Fix ObjectMapper deprecation warnings (#17558)
* Fix ObjectMapper deprecation warnings

Signed-off-by: Steven Sheehy <steven.sheehy@swirldslabs.com>

* Fix missing JsonMapper import

Signed-off-by: Steven Sheehy <steven.sheehy@swirldslabs.com>

---------

Signed-off-by: Steven Sheehy <steven.sheehy@swirldslabs.com>
2024-01-09 16:37:59 +08:00
Milad
8c014372aa
[Java RESTEasy client] updating test to use the Java RESTEasy echo api client (#17367) (#17470)
* updating test to use the Java RESTEasy echo api client (#17367)

* regenerated samples

* set source and target to 1.8 to fix workflow failure, adapted parser
2023-12-26 09:32:51 +08:00
William Cheng
5eab3cef19
Prepare 7.3.0-SNAPSHOT (#17456)
* Revert "v7.2.0 release (#17455)"

This reverts commit fe638d009363c142c246ff089032f243e0b4ee01.

* set version to 7.3.0-SNAPSHOT

* update doc
2023-12-22 16:55:58 +08:00