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

Is @odata.type required on update of a derived type

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.0_ERRATA02
    • Fix Version/s: V4.0_ERRATA03
    • Component/s: Protocol
    • Labels:
      None
    • Environment:

      Applied

    • Proposal:
      Hide

      11.4.3 Update an Entity, paragraph 8:

      Entity id and entity type cannot be changed when updating an entity. However, format-specific rules can require providing entity id and entity type values in the payload when applying the update.

      Show
      11.4.3 Update an Entity, paragraph 8: Entity id and entity type cannot be changed when updating an entity. However, format-specific rules can require providing entity id and entity type values in the payload when applying the update.
    • Resolution:
      Show
      https://www.oasis-open.org/committees/download.php/57136/odata-v4.0-wd08-part1-protocol-2015-12-15.docx

      Description

      The question came up recently as to whether the @odata.type attribute is required when updating a type derived from the type specified for a collection.

      Currently in the protocol spec we say: "The service ignores entity id and entity type values in the payload when applying the update."

      This was added to clarify that:
      1) Clients couldn't change the type of an existing entity, and that
      2) Services weren't required to validate that the type specified in the update was the same as the actual type of the object; it could just apply the values and returned an error if any properties were invalid.

      HOWEVER, in the JSON format specification we say that:

      "The odata.type annotation MUST appear in requests and in responses with minimal or full metadata, if the type cannot be heuristically determined, as described below, and one of the following is true:
      • The type is derived from the type specified for the (collection of) entities or (collection of) complex type instances, or
      • The type is for a property whose type is not declared in $metadata."

      And, in fact, some frameworks may require the type annotation in order to materialize an object of the correct type from the payload from which to apply the update.

      Either way, we should clarify the documents to be consistent.

        Attachments

          Activity

            People

            • Assignee:
              handl Ralf Handl
              Reporter:
              mikep Michael Pizzo (Inactive)
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: