Uploaded image for project: 'OASIS Open Data Protocol (OData) TC'
  1. OASIS Open Data Protocol (OData) TC
  2. ODATA-532

Clarify whether collections can contain null values

    XMLWordPrintable

    Details

      Description

      OData V3 clearly prohibited collections from containing null values.

      In OData V4 we are not as clear. The Atom format specifically prohibits the metadata:null attribute on <element> elements, so we have said you can't have null values in Atom. We don't have the similar restriction in JSON.

      There may be scenarios in applying annotations where a collection ends up containing a null value. i.e.,

      <Collection>
      <Path>BillingAddress</Path>
      <Path>ShippingAddress</Path>
      </Collection>

      Could result in a null value within the collection if BillingAddress is null..

      We do not have a way to say whether or not an instance of a collection could contain null values (i.e., collection(Edm.Int32 nullable=true), nor would I propose we add one unless we think it is important for some clients to support nulls in collections but unreasonable for some services to support.

      Option 1: Clarify that an atom/json payload may contain null values, but don't support nulls in collection valued properties until 4.1.
      Option 2: Clarify that an atom/json payload may ALWAYS contain null values, include for collection valued properties.

      Also, while we're at it, there was some confusion as to whether properties in atom whose value is null but whose underlying type was not string still needed the metadata:type attribute. The answer is yes; no-string primitive properties in Atom always need the metadata:type attribute, even if their value is null. The same rule applies to JSON with full metadata.

        Attachments

          Activity

            People

            • Assignee:
              mikep Michael Pizzo
              Reporter:
              mikep Michael Pizzo
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: