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

Nullable facet should default to false for collection types, rather than being unspecified

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.01_WD01
    • Fix Version/s: V4.01_WD01
    • Component/s: CSDL XML
    • Labels:
      None
    • Proposal:
      Hide

      New proposal from meeting: To be compliant, 4.01 Services MUST specify Nullable for collections. Since this is a new 4.01 requirement, clients SHOULD be prepared for collections that do not specify the value.

      Show
      New proposal from meeting: To be compliant, 4.01 Services MUST specify Nullable for collections. Since this is a new 4.01 requirement, clients SHOULD be prepared for collections that do not specify the value.

      Description

      For the Nullable facet, CSDL errata03 states:

      • If no value is specified for a property whose Type attribute specifies a collection, the client cannot assume any default value.
      • The absence of the Nullable attribute means it is unknown whether the collection can contain null values.

      However evidence from common examples shows that schema authors commonly omit the Nullable facet for collection-valued properties, when they intend/assume that Nullable defaults to false. Also, since it is quite unusual to permit nullable items in a list, if the default Nullable facet for collections were "true", it would result in unnecessary extra work for schema authors.

      It is undesirable for it to be so easy for schema authors to accidentally permit this important facet to have an undefined value.

      Evidence (from errata02 standard vocabularies) has 16 properties and 4 terms with no Nullable facet. However it would appear that none of these intended to allow nullable collection items.

      Searching for: Type="Collection(
      v4_0.errata02.Org.OData.Capabilities.V1.xml(128): <Term Name="SupportedFormats" Type="Collection(Edm.String)">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(133): <Term Name="AcceptableEncodings" Type="Collection(Edm.String)" AppliesTo="EntityContainer">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(161): <Property Name="CallbackProtocols" Type="Collection(Capabilities.CallbackProtocol)" />
      v4_0.errata02.Org.OData.Capabilities.V1.xml(186): <Property Name="FilterableProperties" Type="Collection(Edm.PropertyPath)">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(189): <Property Name="ExpandableProperties" Type="Collection(Edm.NavigationPropertyPath)">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(203): <Property Name="NonCountableProperties" Type="Collection(Edm.PropertyPath)">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(206): <Property Name="NonCountableNavigationProperties" Type="Collection(Edm.NavigationPropertyPath)">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(218): <Property Name="RestrictedProperties" Type="Collection(Capabilities.NavigationPropertyRestriction)" />
      v4_0.errata02.Org.OData.Capabilities.V1.xml(255): <Term Name="FilterFunctions" Type="Collection(Edm.String)" AppliesTo="EntityContainer EntitySet">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(269): <Property Name="RequiredProperties" Type="Collection(Edm.PropertyPath)">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(273): <Property Name="NonFilterableProperties" Type="Collection(Edm.PropertyPath)">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(285): <Property Name="AscendingOnlyProperties" Type="Collection(Edm.PropertyPath)">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(288): <Property Name="DescendingOnlyProperties" Type="Collection(Edm.PropertyPath)">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(291): <Property Name="NonSortableProperties" Type="Collection(Edm.PropertyPath)">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(303): <Property Name="NonExpandableProperties" Type="Collection(Edm.NavigationPropertyPath)">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(337): <Property Name="NonInsertableNavigationProperties" Type="Collection(Edm.NavigationPropertyPath)">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(349): <Property Name="NonUpdatableNavigationProperties" Type="Collection(Edm.NavigationPropertyPath)">
      v4_0.errata02.Org.OData.Capabilities.V1.xml(361): <Property Name="NonDeletableNavigationProperties" Type="Collection(Edm.NavigationPropertyPath)">
      v4_0.errata02.Org.OData.Core.V1.xml(145): <Term Name="AcceptableMediaTypes" Type="Collection(Edm.String)" AppliesTo="EntityType Property">
      v4_0.errata02.Org.OData.Core.V1.xml(161): <Term Name="OptimisticConcurrency" Type="Collection(Edm.PropertyPath)" AppliesTo="EntitySet">
      Found 20 occurrence(s) in 2 file(s)

      Evidence from Microsoft TripPin sample: 3 collection-valued properties (2 of which are missing the Nullable facet)

      C:\projects\xscript\src\test\xs\data\Microsoft.OData.SampleService.Models.TripPin.xml(61): <Property Name="Emails" Type="Collection(Edm.String)"/>
      C:\projects\xscript\src\test\xs\data\Microsoft.OData.SampleService.Models.TripPin.xml(62): <Property Name="AddressInfo" Type="Collection(Microsoft.OData.SampleService.Models.TripPin.Location)"/>
      C:\projects\xscript\src\test\xs\data\Microsoft.OData.SampleService.Models.TripPin.xml(142): <Property Name="Tags" Type="Collection(Edm.String)" Nullable="false"/>

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              evan.ireland.2 Evan Ireland
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: