-
Notifications
You must be signed in to change notification settings - Fork 39
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
Adapter specification incomplete #240
Comments
hi @martijndwars, would you mind proposing a PR to clarify this in the spec? |
Before starting on this, there are some other things that I'd like to include in the spec as well, even if it is just to make explicit that these things are left unspecified (i.e. up to the implementer):
What is your opinion on this? |
Hi @martijndwars , We should do a pass with all implementations (I know yasson and johnzon, not sure there is another one) I think because we can't break too much users on these topics IMHO. Now, assuming we are "free", I'd say:
|
I don’t think it’s being pedantic, this issue seems of importance for predictability of the resulting json (which is crucial to about any application I guess). I’d like an annotation on a type to act as a default only. Relatedly, can I provide both an adapter and a serializer for some type? Which will be used then? Another question about possible loops: what if I provide adapters A to B and B to C and C to A? If the types are incompatible, then (I believe that) it is impossible that the conversion works. Is the runtime allowed to complain early in that case? I believe that such loops should be simply forbidden, for simplicity, and the implementation to fail whenever they want (ideally they would fail as soon as possible, of course). I think that the value of fast failure would greatly override any possible benefit of very edge cases where a loop would actually be useful (if this exists). Related: #169. |
From the specification:
However, the JsonbTypeAdapter annotation has as possible targets
ANNOTATION_TYPE
,TYPE
,FIELD
,METHOD
, which means that you can also annotate a class itself with this annotation and not just a class field.I'm being a bit pedantic, but I thought I'd create an issue so this can be clarified in future versions of the specification.
The text was updated successfully, but these errors were encountered: