users@jsonb-spec.java.net

[jsonb-spec users] [jsr367-experts] Re: Re: Spec update

From: Paul Benedict <pbenedict_at_apache.org>
Date: Fri, 29 Jan 2016 11:55:00 -0600

If I may offer a suggestion, I think @JsonbValue should return and
@JsonbNillable removed.

My reasoning is to make is aligned with the precedent of JPA where the JPA
@Basic annotation is implied for all applicable fields (property/field). If
you must do some customization, you have the option of explicitly
specifying @Basic, for example, like @Basic(optional=true).

I believe @JsonbValue is the equivalent of JPA @Basic and thus it should be
(1) implied and (2) given attribute nillable=true.

Lastly, my suggestion is also harmonious with JAXB's @XmlElement which is
also (1) implied and (2) has a nillable=true.

Cheers,
Paul

On Fri, Jan 29, 2016 at 11:48 AM, Romain Manni-Bucau <
rmannibucau_at_tomitribe.com> wrote:

> Hi Dmitry;
>
> comments inline
>
> 2016-01-29 18:29 GMT+01:00 <dmitry.kornilov_at_oracle.com>:
>
>> Hi,
>>
>> I just pushed a spec update. Please review it and make your comments.
>>
>> Change list:
>>
>> 1. Changed enum processing. Method name() is used for serialization
>> instead of toSting().
>>
>>
> +1
>
>
>>
>> 2. Changed serialization rules of object properties with Optional type
>> and null value.
>>
>> Original:
>> "Empty optional instances serialized as object instance properties are
>> ignored during serialization."
>>
>> Changed to:
>> "Empty optional instances serialized as object instance properties are
>> treated as null."
>>
>> The main purpose of this change is to make Optional fields processing
>> consistent with Optional array elements and properly behaviour in case
>> of @JsonbNillable(value=false).
>>
>> Roman Grigoriadi is preparing a detailed description of this topic at
>> the moment with samples etc. It will be posted in a few days for
>> discussion.
>>
>>
> Sounds consistent.
>
>
>>
>> 3. @JsonbTransient annotation made allowed only on fields.
>>
>> This text is removed:
>>
>> "When placed on a class, indicates that the class shouldn't be mapped
>> to JSON by itself. Properties on such class will be mapped to JSON
>> along with its derived classes, as if the class is inlined."
>>
>>
> +1 while "fields" means field or property.
>
>
>>
>> 4. Removed 'smallest possible type' rule for number types. JSON number
>> type is always mapped to BigDecimal in case target type is not
>> specified. This is done to make numbers serialization and
>> deserialization consistent. We always serialize java.lang.Number by
>> converting it to BigDecimal first and we always deserializing JSON
>> number type to BigDecimal if target type java.lang.Number or Object.
>>
>>
> Should we specify it? Didn't check lately but I think jsonp handles it so
> maybe better to not add rules we could conflict there.
>
>
>>
>> 5. @JsonbValue annotation is removed. Adapters should be used instead.
>>
>>
> sounds good
>
>
>> Thanks,
>> Dmitry Kornilov
>>
>
>