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

Allow services to validate read-only properties in update payloads

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: V4.01_OS
    • Fix Version/s: V4.02
    • Component/s: Protocol
    • Labels:
      None
    • Proposal:
      Hide

      In 4.02, allow services to validate for non-key, non-computed read-only values and return an error if they don't match persisted values.

      Show
      In 4.02, allow services to validate for non-key, non-computed read-only values and return an error if they don't match persisted values.

      Description

      Section 11.4.3, Updating an Entity states: 

      Key and other properties marked as read-only in metadata (including computed properties), as well as dependent properties that are not tied to key properties of the principal entity, can be omitted from the request. If the request contains a value for one of these properties, the service MUST ignore that value when applying the update. Services MUST return an error if an insert or update contains a new value for a property marked as updatable that cannot currently be changed by the user (i.e., given the state of the object or permissions of the user). The service MAY return success in this case if the specified value matches the value of the property. Clients SHOULD use PATCH and specify only those properties intended to be changed.
      

      We defined the semantics this way because we wanted the ability to take a response payload, make some changes, and PUT it back without having to remove properties that were not updatable by the client.

      We chose "ignore" because:
      1) We wanted to ignore key properties because we wanted the ability to take a response payload from one service and use it to insert into another service.
      2) We wanted to ignore computed properties because the computed value could change based on other properties in the payload or on external information.

      However, "read-only" is not a strictly defined term – it refers generically to properties that can't be changed by the user and includes not only key and computed properties, but other read-only properties.

      For other such read-only properties, it may be useful, and should be valid, for services to validate that the value of the read-only property matches the stored value and, if not, return an error.

        Attachments

          Activity

            People

            • Assignee:
              mikep Michael Pizzo (Inactive)
              Reporter:
              mikep Michael Pizzo (Inactive)
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: