crnk-framework
crnk-framework copied to clipboard
CrnkClient transform zero into null when creating a resource
If you have a resource with a Long
property and you pass 0
and try to create the resource via CrnkClient, the value is lost and becomes null.
I did not test it with other numeric types.
You can check and reproduce the error here: https://github.com/marciovmartins/crnk-zero-long-become-null
I assume Long rather long? somewhere in the area of crnkclient/repository stubs/ResourceMapper there is a behavior that omits default values and only senda changes. there likely is a bug in there if Long is used.
Yes, Long
.
Is this the desired outcome or is really a bug? Could the fix break something else?
I found this code:
Why the default value is not added to the attribute? What's the design decision behind that?
cleaner POST requests. A shortcut to avoid having to use Long rather than long for such purposes. this is most notable when using the asciidoc doc generation. itnwill.give much cleaner examples.
ok-ish, maybe a bit borderline😬. but it should not have that behavior for non-primitive number types.
Marcio Vinicius @.***> schrieb am Fr., 21. Mai 2021, 09:01:
I found this code:
[image: image] https://user-images.githubusercontent.com/6377735/119095786-0373d580-ba13-11eb-93b5-0617778ffe3f.png [image: image] https://user-images.githubusercontent.com/6377735/119095491-a2e49880-ba12-11eb-878c-9bd3e22c7a1a.png
Why the default value is not added to the attribute? What's the design decision behind that?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/crnk-project/crnk-framework/issues/813#issuecomment-845710631, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5DJFIWNEOOQ7YTEHY27NDTOYAOHANCNFSM45FKLS2A .
Would be a good idea to add an annotation or configuration flag for this behavior?
Like @EnableCleanerPost
, @DisableCleanerPost
, @CleanerPost(value = true)
or something similar.
How the framework deals with this kind of configuration?