crnk-framework
crnk-framework copied to clipboard
JsonProperty is not respected on filter
I have a resource with this getter:
@JsonProperty("isInWork")
public Boolean isInWork() {
return {obtained from database}
}
But when I do this query
http://localhost:8080/api/my-resource?filter[isInWork]=true
And debug my API repository's findAll method, does not keep the property as is_in_work

What I did to overcome the situation by making a custom implementation of io.crnk.core.queryspec.internal.DefaultQueryPathResolver that sets the property mapJsonNames to false. That seems to fix the issue.
I have been debugging, and seems that this line is not correct:
https://github.com/crnk-project/crnk-framework/blob/master/crnk-core/src/main/java/io/crnk/core/queryspec/internal/DefaultQueryPathResolver.java#L91
It shouldn't be the other way around?
Thank you!
the line itself looks ok, not? if the source is json, it maps it tona java name.and vice versa. an issue with the caller?
@remmeier Sorry maybe I didn't understand what does the code yet.
So then the mapJsonNames property in DefaultQueryPathResolver.java does convert the names from the query into Java names, but that affects the @JsonProperty annotation is not considered? If that's true then the code is ok, and I just didn't expect that behaviour.
Then it could be nice if that property is configurable, the same that it is allowUnknownAttributes.
if you like you can add a test case, notnsure yet where the problem is. it should respect the json property annoation everywhere and map accorgingly