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

Support overwriting property in derived type with a property of a type derived from property in base type

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.0_ERRATA02
    • Fix Version/s: V4.01_WD01
    • Component/s: CSDL JSON, CSDL XML
    • Labels:
      None
    • Environment:

      [Proposed]

    • Proposal:
      Hide

      Allow a property in a derived type to override a property of the base type with a property that is derived from the type of the property defined in the base type. i.e., complex type with derived complex type, edm.primitive with primitive, entity type of a nav prop with entity type of a nav prop.

      Show
      Allow a property in a derived type to override a property of the base type with a property that is derived from the type of the property defined in the base type. i.e., complex type with derived complex type, edm.primitive with primitive, entity type of a nav prop with entity type of a nav prop.
    • Resolution:
      Show
      https://www.oasis-open.org/apps/org/workgroup/odata/download.php/59031/odata-csdl-xml-v4.01-wd01.docx

      Description

      Today we allow types to derive from base types and define new properties, but we don't allow overriding existing complex typed properties with derived complex typed properties.

      That means I can define a type FOO with property bar of type BAR:

      <EntityType Name="FOO" IsAbstract="True">
      <Property Name="bar" Type="ns.BAR"
      </EntityType>

      <ComplexType Name="BAR">
      <Property Name="property1" Type="Edm.String"/>
      </ComplexType>

      I can define type FOO2 that adds required properties to FOO, and I can define type BAR2 that adds required properties to BAR:

      <EntityType Name="FOO2" BaseType="ns.FOO">
      <Property Name="requiredOnFOO2" Type="Edn.String" Nullable="false"/>
      </EntityType>

      <ComplexType Name="BAR2" BaseType="ns.BAR">
      <Property Name="requierdpropertyOnBAR2" Type="Edm.String" Nullable="false"/>
      </ComplexType>

      But I can't add require that instances of FOO2 have the required properties of BAR2 (i.e., that property bar be of type BAR2).

      What we would need to do in order to support this is to allow a property in a derived type to override a complex-typed property of the base type with a complex type that is derived from the type of the property in the base type.

      For example:
      <EntityType Name="FOO2" BaseType="ns.FOO">
      <Property Name="bar" Type="ns.BAR2" />
      </EntityType>

      The definition of "bar" in FOO2 overrides the definition of "bar" in FOO, meaning that any property "bar" of an instance of FOO2 must be of type BAR2.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: