-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
@JsonProperty(access = Access.READ_ONLY) - unexpected behaviour #935
Comments
That does sound like a bug indeed. Which version are you using? |
Whoa. There is no unit test coverage for value of |
I can reproduce this with 2.6. Looks like |
I added a failing test case for this, but not sure how easy it will be to pipe "do ignore" information. Thank you for reporting the problem again. |
Thanks for dealing with the issue and sorry for the lack of details in my description. Afaik Access.READ_ONLY has just been added in 2.6. I also got the UnrecognizedPropertyException: Unrecognized field "fullName" ... not marked as ignorable |
Correct, it's 2.6 only which is why I realized that asking for version wasn't fully necessary (but only after asking). The fix would be to essentially carry along the name as "ignorable" property, similar to how |
Hi, is there some easy workaround, until this is fixed? I mean instead of implementing a noop setter method? The annotation @JsonIgnoreProperties sounds like it could help here. But it also has no effect, if I add it to a getter, regardless which values I choose for allowGetters or allowSetters. Update: It seems that I found a solution by adding
to the class. So this could be a solution, if we don't need the @JsonIgnoreProperties annotation on class level for other purposes. |
@plattfish thank you for sharing this. I am hoping to address this, along with some issues with creator property handling, in 2.8. |
Any movement here? I just bumped into this issue. |
Don't know if related, but I'm experiencing this with a public class Ticket {
@JsonProperty(access = Access.READ_ONLY)
@JsonSerialize(using = MapToArraySerializer.class)
public SortedMap<Timer, Integer> getServiceTimers() {
// ...
}
} All works on serialization, but on deserialization of
I'm on Jackson 2.8. |
+1 |
This disabling this feature on your ObjectMapper helped me avoid this issue. |
Hi @cowtowncoder - any word on a fix for this? I am using 2.8.5, and it appears the issue persists. @plattfish's solution did not work for me. |
@philbayer no activity on this one. I have been slowly fixing similar bugs, hope to have another look at this one. Thank you for the ping, for some reason I hadn't tagged it. |
only working with jackson 2.8.7-SNAPSHOT see FasterXML/jackson-databind#935
to avoid to accidentally set them to null Revert "fixed with skipping ignored properties" This reverts commit 8d85c61. fixed with skipping ignored properties only working with jackson 2.8.7-SNAPSHOT see FasterXML/jackson-databind#935 reproduce DATAREST-1006
@cowtowncoder I pulled in v2.8.7 for jackson-databind but unable to do deserialize on a
Only if I remove the |
@jyothri If there are remaining problems, please file a new issue, with reproduction. It is possible that fix is incomplete, or something in your setup differs significantly; I don't know without reproduction. |
Has this been fixed in 2.8.9? I still seem to be seeing this issue. Edit: Plattfish's workaround works for me! |
@YashArya Please read my previous comment. It is fixed to the best of my knowledge -- for remaining problems, if any, please file a new issue with reproduction showing what is not working. |
I agree, this does not work until now I use spring-boot 1.5.10 |
@AngorSTV Please do not keep adding comments on closed issues -- I really do not care for +1s if no one files a new case with reproduction. Reproduction must not rely on frameworks like Spring Boot. |
Neither I just cannot set the value during deserialization. |
Try READ only, I think the annotations are from the frameworks perspective, not the client. |
@jwgmeligmeyling is correct: naming is not be as intuitive as I originally hoped: [INCORRECT EXPLANATION, REMOVED] |
Thank you, but damn the documentation on this is confusing.
It says that |
|
@iuliana Can you please file a new issue with the link. I don't usually re-open issues in cases where there has been a previous fix as that will make release notes more difficult to follow up. |
Also: my earlier explanation was exactly backwards. Javadocs state it correctly (if not well): I really should have named values differently (GETTER_ONLY, SETTER_ONLY, perhaps). |
I think this is still not fixed. I have the same problem with 2.10.3 Here is the stacktrace:
FYI: |
Hey,
I was hoping to make use of @JsonProperty(access = Access.READ_ONLY), but failed.
Assume this class:
I couldn't find a way to stop the deserializer from attempting to deserialize the field "fullName".
The only thing that helps is to create a setter and annotate it with
@JsonIgnore
. However, that setter does not make sense and I don't want to have it. Is this a bug in behaviour or am I missing something? ThanksThe text was updated successfully, but these errors were encountered: