1541 Commits

Author SHA1 Message Date
William Cheng
a745f053bd
skip custom adapter for parent object (#10998) 2021-12-01 14:20:39 +08:00
William Cheng
b061bd2146
[Java][Okhttp] Add oneOf support (#10875)
* add custom gson deserializer

* add check for additional fields, required fields

* add tests for custom deserializer

* add custom adapter

* add custom adapter

* register type adapter factory

* comment out custom deserializer and use adapter instead

* add okhttp-gson-nextgen

* add new files

* restore okhttp-gson

* switch to adapter

* remove custom de/serializer

* add comment

* update tests

* test nextgen in ci

* update doc

* use full model name in JSON.java

* undo changes

* add oneof discriminator support

* fix anyOf

* remove mappings

* add more tests

* fix oneof deserialization, add more tests

* add error body and type to api exception class

* JSON to use instance variables/methods

* Revert "add error body and type to api exception class"

This reverts commit 07f34e2c450ad9f808b728173018b1e4d8fed458.
2021-11-30 15:33:42 +08:00
Kevin Chen
3d92df5a41
[Java][okhttp-gson] Support text/plain body (#10885)
* support serialize RequestBody with contentType text/plain

* add Serialize test

* update test comment
2021-11-26 15:04:19 +08:00
Berlin Cho
8e303150ae
[Java][resttemplate] Support URL queryParams Comma encoding (#10958)
* Java Encode comma (with unit tests)

* fix PMD warnings
2021-11-25 16:12:55 +08:00
Steve Mason
5bd0452893
[Java][Native] Drain InputStream when no response is being read (#10956)
The [docs for ofInputStream](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.BodySubscribers.html#ofInputStream()) say:

> To ensure that all resources associated with the corresponding exchange are properly released the caller must ensure to either read all lines until the stream is exhausted, or call BaseStream.close() if it is unable or unwilling to do so. Calling close before exhausting the stream may cause the underlying HTTP connection to be closed and prevent it from being reused for subsequent operations.

When ObjectMapper.readValue is called with an InputStream it implicitly closes it, but when the library is not expecting a return type it's not passing the InputStream to Jackson, so the stream needs to be manually drained and closed as per the docs

Failure to do this leads to a leak of HttpClient socket handles, and ultimately the exception `java.net.BindException: Cannot assign requested address` when trying to make API calls
2021-11-25 14:44:57 +08:00
AJ Rice
08eaafa871
Add operation level servers support for java okhttp-gson client (#10925)
* Add Operation Servers to {operation}Call method

* add getter/setter methods

Add methods for hostIndex and customBaseUrl

* Fix return types for getters

* Add custom baseUrl logic

if you dont specifically declare a custom base url using the set method then it uses the 1st server in the operation host index array

if no custom url is set and the operation base path array is empty however, the call throws an exception

* Update server selection logic

First checks to see if a custom url is provided

If not, checks to see if operation level server is defined and uses the supplied host index (default 0)

If neither is supplied, uses the ApiClient default base path

* Update samples and docs
2021-11-25 14:17:50 +08:00
WILLIAM CHENG
c619f7fd63 fix java okhttp oauth test 2021-11-21 11:29:00 +08:00
WILLIAM CHENG
eb75515715 Merge branch '5.4.x' into 6.0.x 2021-11-21 09:50:47 +08:00
WILLIAM CHENG
78fe5dc427 Merge remote-tracking branch 'origin/master' into 5.4.x 2021-11-21 09:43:21 +08:00
William Cheng
e44c69dab1
fix outdated link, improve docstring (#10870) 2021-11-17 11:17:48 +08:00
William Cheng
3c26f9f2b4
[Okhttp] fix warnings and better docstrings for constructors (#10859)
* surpress serial warning

* better docstrings in api client java class
2021-11-15 17:49:27 +08:00
William Cheng
c06a21e638
update authentication to include more parameters (#10858) 2021-11-15 16:34:27 +08:00
Oleh Kurpiak
e7c3bdacc2
[Java] fix deserialization of readonly properties (#10113)
* [Java] fix deserialization of readonly properties

* [Java] fix deserialization of readonly properties

* [Java] fix deserialization of readonly properties

* [Java] fix deserialization of readonly properties
2021-11-14 22:05:25 +08:00
Oleh Kurpiak
3bdbf0339a
[Java] deserialize to LinkedHashSet when unique items (#10241)
* [Java] deserialize to LinkedHashSet when unique items

* [Java] fix deserialization of readonly properties

* [Java] deserialize to LinkedHashSet when unique items
2021-11-14 22:03:02 +08:00
Vincent Galloy
955aadc284
10788: ApiClient for resttemplate should not produce warning (#10789)
Motivation:

Remove useless warnings for webclient and resttemplate
2021-11-09 14:38:57 +08:00
William Cheng
3284fc2f7e
skip spotless as part of the check task (#10797) 2021-11-06 18:50:38 +08:00
William Cheng
bd1a6471b6
[java][Jersey2] add spotless maven, gradle plugins (#10796)
* add bunker-holding logo

* add spotless plugin to jersey2 java client

* add spotless plugin to java jersey2 client

* use jdk11 in gradle tests

* fix gradle test local spec

* setup java 11

* skip spotless in check task
2021-11-06 18:11:58 +08:00
William Cheng
a73363fd53
[java][okhttp] Add spotless maven, gradle plugin (#10785)
* add spotless maven plugin

* add spotless gradle plug-in

* add spotless version
2021-11-05 17:48:14 +08:00
William Cheng
4ecceb13ea
[Java][okhttp] remove default content-type in the request (#10769)
* remove default content-type in java okhttp client

* update smaples

* update tests
2021-11-04 10:19:13 +08:00
William Cheng
9d1420dc94
fix bug in query collection parameters (#10768) 2021-11-03 22:13:33 +08:00
William Cheng
48f81eef45
use IllegalArgumentException instead (#10745) 2021-11-02 12:47:15 +08:00
WILLIAM CHENG
4f2b5ee36d Merge remote-tracking branch 'origin/5.4.x' into 6.0.x 2021-11-01 00:54:44 +08:00
WILLIAM CHENG
ab603a7322 Merge remote-tracking branch 'origin/master' into 5.4.x 2021-11-01 00:49:06 +08:00
William Cheng
9546a5a61b
[Java][okhttp] better docstring (#10741)
* better docstring in api client, exception, response

* more docstring update
2021-11-01 00:47:32 +08:00
William Cheng
68b5f866ff
update readme with better gradle instruction (#10740) 2021-10-31 23:10:46 +08:00
William Cheng
8551b0af49
[java][jersey2] remove warning using JsonMapper.builder (#10734)
* remove warning usign JsonMapper.builder

* add back java8 tag
2021-10-30 16:55:33 +08:00
William Cheng
c3740dd647
update scribejava to 8.x (#10733) 2021-10-30 14:42:48 +08:00
William Cheng
2b2838325c
[java][okhttp-gson] update dependencies in pom.xml (#10709)
* update okhttp-gson pom dependencies

* update samples

* remove jar
2021-10-29 12:36:52 +08:00
William Cheng
d75683aeae
[java][jersey2] update plugins in pom.xml (#10710)
* update jersey2 plugin

* remove jar
2021-10-29 12:36:40 +08:00
Martin Visser
59d5851797
Fix library generation compatibility with Gradle 7.2 (#10716)
* Make Java libraries compatible with Gradle 7

* Make kotlin-spring compatible with Gradle 7

* Update samples to comply to Gradle 7.2

* Generate samples
2021-10-29 12:36:12 +08:00
William Cheng
1c38bfd5a0
update microprofile to newer version (#10714) 2021-10-27 23:42:46 +08:00
Maximilian Zellhofer
6bbafdfa30
Allow specification of configkey for microprofile clients (#10693) 2021-10-27 14:28:17 +08:00
WILLIAM CHENG
3594b3452d Merge remote-tracking branch 'origin/5.4.x' into 6.0.x 2021-10-25 13:31:12 +08:00
WILLIAM CHENG
42f4e863b7 prepare 5.4.0-SNAPSHOT 2021-10-25 12:13:33 +08:00
William Cheng
378465702c
Prepare v5.3.1 in the master (#10681)
* prepare v5.3.1

* update doc

* update readme
2021-10-25 01:16:07 +08:00
William Cheng
2413783288
update build.gradle to work with gradle 7.x, add test (#10669) 2021-10-24 12:19:52 +08:00
William Cheng
ec2ed98269
better comment/docstrings in jersey2 apiclient (#10668) 2021-10-24 12:19:20 +08:00
William Cheng
bb37a71d06
update dependencies in build.sbt to newer versions (#10667) 2021-10-23 16:17:46 +08:00
Maciej Sitarz
2875c7e14d
Improve Apache Httpclient support (#10624)
* Move apache-httpclient templates to proper dir

* Add template for Gradle

* Fix few JavaDoc compile warnings

* Add properly generated samples

* Empty just trigger PR checks rebuild
2021-10-23 14:57:32 +08:00
WILLIAM CHENG
afacdb229a Merge remote-tracking branch 'origin/master' into 6.0.x 2021-10-23 10:16:27 +08:00
William Cheng
7b7d7db0c7
[Java][okhttp] rename enum (#10642)
* rename java enum with uppercase

* add tests for snake case lambda

* update file header

* update feign templates with new enum names

* update okhttp template wth lambda

* fix tests
2021-10-23 10:15:30 +08:00
William Cheng
885a813f86
update java jersey2 dependencies (#10659) 2021-10-23 10:13:39 +08:00
William Cheng
681578d1b5
rename enum constants (#10631) 2021-10-22 09:26:48 +08:00
William Cheng
730636ad31 Merge remote-tracking branch 'origin' into 6.0.x 2021-10-19 12:55:59 +08:00
Hugo Alves
ff286aa06f
[Java][Feign] Add http status to feign result (#10583)
* Add .circleci/config.yml

* Add Http status to the feign response wrapper

* Add Http status to the feign response wrapper

* Add Http status to the feign response wrapper

Fix typo

* Add Http status to the feign response wrapper

Fix typo

* Rename HttpResponse to ApiResponse
2021-10-19 00:04:32 +08:00
William Cheng
2bd2c23115
Revert "[JAVA][jersey2] import the auto generated supporting JSON class only when discriminator is needed (#10557)" (#10597)
This reverts commit 52713b21d452bcc4219793861443b495d2a03213.
2021-10-14 11:41:19 +08:00
beytun
52713b21d4
[JAVA][jersey2] import the auto generated supporting JSON class only when discriminator is needed (#10557)
* Import the auto generated supporting JSON class only when discriminator is needed

* Generate samples again
2021-10-12 16:05:38 +08:00
William Cheng
4b62b55877
use implementation, add min version of maven, gradle (#10571) 2021-10-11 21:10:04 +08:00
Hugo Alves
331b61dc1c
[Java][Feign] Expose response headers for feign client (#10507)
* Add .circleci/config.yml

* Add the property exposeResponseHeaders to feign client

This new property indicates if the feign client should expose the response headers on the API class.

* Generate new docs for exposeResponseHeaders additional property

* Rename HeaderAwareResponse to HttpResponse

* Update samples

* Refactor the implementation to use the same approach as the c# generator.
Creates a new feign operation with the suffix WithHttpInfo, this operation returns the response encapsulated in a HttpResponse class.
The HttpResponse class contains the decoded body and the response headers

* Refactor the implementation to use the same approach as the c# generator.
Generate samples

* Refactor the implementation to use the same approach as the c# generator.
Generate docs

* Use Void instead of void for HttpResponse parameterized type
2021-10-09 15:50:55 +08:00
William Cheng
96c65fea61
[Java] add an option to customize gradle.properties (#10540)
* add an option to customize gradle properties

* add more info to gradle.properties
2021-10-08 11:20:50 +08:00