Skip to content

Add a method metadata property, in order to control whether need to c…#583

Closed
dyc87112 wants to merge 2 commits into
OpenFeign:masterfrom
dyc87112:master
Closed

Add a method metadata property, in order to control whether need to c…#583
dyc87112 wants to merge 2 commits into
OpenFeign:masterfrom
dyc87112:master

Conversation

@dyc87112

Copy link
Copy Markdown

hello, this pull request is to make the request Body to be an optional properties.

Current version, if the body is null, feign will return error message “Body parameter %s was null”.

If this PR can be accept. Then I can fix another issue in Spring Cloud Feign:https://github.com/spring-cloud/spring-cloud-netflix/issues/1047

Thanks.

Comment thread core/src/main/java/feign/MethodMetadata.java Outdated
@velo

velo commented Mar 11, 2018

Copy link
Copy Markdown
Member

Hey, why don't you overload the method, creating a new one without the body.

That would accomplish it without passing nulls forward.

I see a point on supporting Optional<Body>.

Lemme know what you think.

@kdavisk6

Copy link
Copy Markdown
Member

@dyc87112 There are no test cases included in this PR. Could you please add some to ensure that we have coverage?

@kdavisk6 kdavisk6 added the waiting for feedback Issues waiting for a response from either to the author or other maintainers label Jul 16, 2018
@kdavisk6

Copy link
Copy Markdown
Member

ping?

How would you intend for the bodyRequired flag to be set?

@velo

velo commented Nov 15, 2018

Copy link
Copy Markdown
Member

2 months no feedback. Closing, please re-open if necessary

@velo velo closed this Nov 15, 2018
@cezar-tech

cezar-tech commented Oct 17, 2019

Copy link
Copy Markdown
Contributor

@velo @kdavisk6
If you are interested perhaps I can help but I understand ver few of how Feign works internally.
If you could explain me how to do it I can give a try.

@velo

velo commented Oct 17, 2019

Copy link
Copy Markdown
Member

Well, I'm not sure what was the goal on this pr.

You would need the author back on the discussion.

@OlgaMaciaszek

Copy link
Copy Markdown

Hi, @dyc87112 @velo @kdavisk6 I would like to reopen the discussion of this PR. This kind of functionality would be useful for us to fix this issue, also discussed here. I see the PR was closed due to lack of tests and feedback. I can take it over and add tests if you are fine with adding this feature.

@velo

velo commented May 12, 2020

Copy link
Copy Markdown
Member

Lemme see if I got it correctly.

Spring has an annotation @RequestBody that can be used to "ignore" a parameter.

So, you looking for a mechanism to tell feign to not process a parameter?!

Saw many comments on the ticket and didn't read them all.

@kdavisk6

Copy link
Copy Markdown
Member

@OlgaMaciaszek

Can please create a new issue referencing your issue? I'd like to move the discussion there so it does not get lost.

@SribniyOleg

Copy link
Copy Markdown

@kdavisk6
Hi - i can refactor this pr or just create a new one with this case.
In my case I'm facing with the same issue with the author - just need to enable Feign to support RequestBody(required = false ) cuz I need to the optional body for my logic

@velo

velo commented Aug 5, 2021

Copy link
Copy Markdown
Member

We need to differentiate NULL body, from absent

Having another boolean flag is not healthy they will explode out of control someday

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting for feedback Issues waiting for a response from either to the author or other maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants