conjure-java-runtime icon indicating copy to clipboard operation
conjure-java-runtime copied to clipboard

Servers cannot deserialize empty primitive optional values sent by Feign clients

Open pkoenig10 opened this issue 5 years ago • 1 comments

What happened?

A service is exposing an endpoint with an OptionalLong header parameter. A Conjure Feign client calls this endpoint with an OptionalLong.empty() value and receives a 400 because this parameter fails to deserialize with NumberFormatException.

What did you want to happen?

The request from the client should have succeeded.

Details

This is related to https://github.com/palantir/conjure-java-runtime/issues/790.

Requests with Optional<T> parameters work because Jersey will return null if an exception is thrown while deserializing an empty string.

pkoenig10 avatar Nov 20 '19 22:11 pkoenig10

The conjure spec requires optional headers to be absent from the request to deserialize into an empty optional, otherwise we would not be able to differentiate between a present optional of an empty string, and and absent optional.

carterkozak avatar Nov 20 '19 22:11 carterkozak