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

optional path parameter on retrofit

Open bavardage opened this issue 8 years ago • 5 comments

For a retrofit client with an optional path parameter e.g. @Query("foo") Optional<String> foo, passing in an Optional.empty() will result in the query parameter still being included in the request, just with a no value... e.g. GET my/path?foo=

then on the server side, this results in an Optional.of("") rather than the expected Optional.empty(). Not sure if there's something we can do here...

bavardage avatar Mar 24 '17 23:03 bavardage

It looks like we can return null instead of the empty string for path params and it would fix this. Want to contribute a fix to https://github.com/palantir/http-remoting/blob/develop/retrofit2-clients/src/main/java/com/palantir/remoting2/retrofit2/OptionalObjectToStringConverterFactory.java to handle Query annotations differently from Path annotations?

markelliot avatar Mar 26 '17 13:03 markelliot

This issue has been automatically marked as stale because it has not been touched in the last 60 days. Please comment if you'd like to keep it open, otherwise it'll be closed in 7 days time.

stale[bot] avatar Oct 20 '18 00:10 stale[bot]

I'd like to keep this open and make sure the validation is baked into conjure-verification.

iamdanfox avatar Oct 29 '18 10:10 iamdanfox

This issue has been automatically marked as stale because it has not been touched in the last 60 days. Please comment if you'd like to keep it open, otherwise it'll be closed in 7 days time.

stale[bot] avatar Dec 28 '18 11:12 stale[bot]

This issue has been automatically marked as stale because it has not been touched in the last 60 days. Please comment if you'd like to keep it open, otherwise it'll be closed in 7 days time.

stale[bot] avatar Sep 23 '19 14:09 stale[bot]