question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Conditional Parameter Expansion

See original GitHub issue

Hi!

We define our Spring MVC APIs with @RequestParam Optional<Type> something.

It looks like Feign doesn’t handle it well and uses “toString()” version so that Spring fails to convert String -> Optional

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:3
  • Comments:18 (11 by maintainers)

github_iconTop GitHub Comments

7reactions
dbaltorcommented, Jul 7, 2020

We can support Optional<T> as a return type. but we do not support is as a @Param. I’ll add this to the backlog for us to consider, however; feel free to submit a PR for this if you cannot wait.

Has support to Optional<T> @Param been implemented in Feign?

0reactions
kdavisk6commented, Dec 27, 2019

@yami12376

We are considering adding support for Level 2-4 uri template expression which will address most of what is discussed in this request. Specifically, we will adhere to the RFC rules regarding what to do when the value is undefined, which in our case is an explicit null. Empty Strings are not considered undefined, just empty, which are still included.

For example, using form style expressions http://localhost:8132/test{?name}, the result would be as follows:

name is present
http://localhost:8132/test?name=value
name is present and empty
http://localhost:8132/test?name=
name is not present
http://localhost:8132/test

The only situation this will not handle is the case where a user may want to override this behavior for a single expression. Using the example above where the desired result is the variable on the query string without the = sign, we would need provide a facility to override the expansion logic. We may also consider extending the capability of the Expander concept for this; however for Feign 11, we are going to focus primarily on the template levels.

Read more comments on GitHub >

github_iconTop Results From Across the Web

An introduction to parameter expansion in Bash
Conditional parameter expansion. Conditional parameter expansion allows branching on whether the parameter is unset, empty, or has content.
Read more >
Shell Parameter Expansion (Bash Reference Manual) - GNU.org
The expansion is a string in the form of an assignment statement or declare command that, if evaluated, will recreate parameter with its...
Read more >
How To Use Bash Parameter Substitution Like A Pro - nixCraft
Explains how to use Bash Parameter Substitution for string matriculation and expansion - includes tons of practical examples.
Read more >
Bash Parameter Expansion - Linux Hint
Parameter expansion can be categorized by three groups. These are conditional parameter expansion, substring parameter expansion, and substitute parameter ...
Read more >
10.2. Parameter Substitution
Same as $parameter, i.e., value of the variable parameter. In certain contexts, only the less ambiguous ${parameter} form works. May be used for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found