OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

camp message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Use of Cardinality for JSON array attributes


For some reason I could not get access to raise a new Jira issue.

I am sending this email for discussion before a formal issue is raised.

There are several attributes defined with an array type (e.g, String[] . Link[])

These attribute definitions have various cardinality values, including, 1, 0..1, or 0..*  

It makes no sense for an array attribute to have cardinality 0..*, for this implies multiple arrays in the JSON serialization.

In the case of 0..1 cardinality, Is there a difference in having an array present with 0 elements, versus not having the array present?

In the case of 1 cardinality, is it allowed to have an array with 0 elements present for its serialization?

There does not seem to be a way to specify that an array should not be present in the serialization with zero elements.  What is the difference between no attribute in the serialization, verses an array attribute with no elements?

Proposal:

Lets make the cardinality property of an attribute express the actual semantics of presence.

If the cardinality is 1 it should imply that the attribute is always present, and sent as a basic type value.

If the cardinality is 0..1, it should imply the attribute may be present, and if present is sent as a basic type value.

If the cardinality is 1…*, it should imply that the attribute is alwasy present and sent using an JSON array.  The type in the definition should be the base type (e.g, change Link[] to Link in the definitions of type)

If the cardinality is 0..1, it should imply that the attribute may or not be present,  If present it is sent using a JSON array. It could be constrained to not send empty arrays. The type in the definition should be the base type (e.g, change Link[] to Link in the definitions of type)  




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]