Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@QueryMap doesn't work with inheritance #927

Closed
StasKolodyuk opened this issue Mar 26, 2019 · 3 comments
Closed

@QueryMap doesn't work with inheritance #927

StasKolodyuk opened this issue Mar 26, 2019 · 3 comments
Labels
enhancement For recommending new capabilities help wanted Issues we need help with tackling

Comments

@StasKolodyuk
Copy link

Hi,

I've raised an issue in spring-cloud-openfeign project related to @SpringQueryMap not working with inheritance.

However, seems like the root cause is in FieldQueryMapEncoder of feign-core

private static ObjectParamMetadata parseObjectType(Class<?> type) {
return new ObjectParamMetadata(
Arrays.stream(type.getDeclaredFields())
.filter(field -> !field.isSynthetic())
.peek(field -> field.setAccessible(true))
.collect(Collectors.toList()));
}

It uses type.getDeclaredFields() which returns only fields of a class without inherited fields.

Thanks

@kdavisk6
Copy link
Member

@StasKolodyuk

Thanks for bringing this up. If I recall, this is by design, as Feign's support for bean properties is intentionally simple. This would be an enhancement for us. So I've marked this issue as such. If you would like this feature, please feel free to open a PR.

@kdavisk6 kdavisk6 added enhancement For recommending new capabilities help wanted Issues we need help with tackling labels Mar 26, 2019
@FatTigerWang
Copy link

@StasKolodyuk

谢谢你提出这个问题。如果我记得,这是设计,因为Feign对bean属性的支持是故意简单的。这对我们来说是一种增强。所以我已经标记了这个问题。如果您想要此功能,请随时打开公关。

support inheritance is very important

mstrYoda added a commit to mstrYoda/feign that referenced this issue May 8, 2019
add apache commons lang3 as mvn dependency to get inherited fields of given class

change type.getDeclaredFields() to FieldUtils.getAllFieldsList(type) on FieldQueryMapEncoder
kdavisk6 pushed a commit that referenced this issue May 28, 2019
* This pr resolves issue #927

add apache commons lang3 as mvn dependency to get inherited fields of given class

change type.getDeclaredFields() to FieldUtils.getAllFieldsList(type) on FieldQueryMapEncoder

* format

* remove apache common langs dependency
add logic for finding fields which comes via inheritance
@kdavisk6
Copy link
Member

Resolved via #960

velo pushed a commit to velo/feign that referenced this issue Jun 30, 2019
)

* This pr resolves issue OpenFeign#927

add apache commons lang3 as mvn dependency to get inherited fields of given class

change type.getDeclaredFields() to FieldUtils.getAllFieldsList(type) on FieldQueryMapEncoder

* format

* remove apache common langs dependency
add logic for finding fields which comes via inheritance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement For recommending new capabilities help wanted Issues we need help with tackling
Projects
None yet
Development

No branches or pull requests

3 participants