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

Upsert: clarify upsert along nullable single-valued navigation path

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.01_CS01
    • Fix Version/s: V4.01_CS02
    • Component/s: Protocol
    • Labels:
      None
    • Environment:

      Applied

    • Proposal:
      Hide

      PUT or PATCH to a single-valued navigation property reference (i.e., customers/salesperson/$ref) MUST only include the entity id, and changes which entity is referenced by the navigation property.

      PUT or PATCH to a single-valued navigation property (i.e., customers/salesperson) performs an update on the currently related resource. If the value of the navigation property is non-null then any key values are ignored and the referenced entity is updated. If the value of the navigation property is null, for a containment relationship a resource is created (since the single-valued navigation path identifies the resource). For a non-containment relationship, PUT or PATCH to a null single-valued navigation property returns an error.

      The same semantics apply to singletons on the entity container, which are semantically contained single value navigation properties.

      Show
      PUT or PATCH to a single-valued navigation property reference (i.e., customers/salesperson/$ref) MUST only include the entity id, and changes which entity is referenced by the navigation property. PUT or PATCH to a single-valued navigation property (i.e., customers/salesperson) performs an update on the currently related resource. If the value of the navigation property is non-null then any key values are ignored and the referenced entity is updated. If the value of the navigation property is null, for a containment relationship a resource is created (since the single-valued navigation path identifies the resource). For a non-containment relationship, PUT or PATCH to a null single-valued navigation property returns an error. The same semantics apply to singletons on the entity container, which are semantically contained single value navigation properties.
    • Resolution:
      Show
      https://www.oasis-open.org/committees/download.php/64119/odata-v4.01-wd06-part1-protocol-2018-10-19.docx  

      Description

      Section 11.4.4 Upsert an Entity allows upsert request to any URL that identifies a single entity. It then references section 11.4.2 Create an Entity, which only talks about creating entities in a collection.

      This question also arises in the context of "deep update" with nested entities for single-valued navigation.

        Attachments

          Activity

          handl Ralf Handl created issue -
          handl Ralf Handl made changes -
          Field Original Value New Value
          Environment Proposed
          Status New [ 10000 ] Open [ 1 ]
          handl Ralf Handl made changes -
          Proposal Clarify that upsert is also valid along a nullable single-valued navigation property.

          If the key property values are client-defined, this is straight-forward.

          If the key values are server-generated, the client can specify a key value, in which case the identified target is related and updated with provided non-key property values. And the client can omit the key properties, in which case a new entity is created from the provided property values and then related.
          Description Section 11.4.4 Upsert an Entity allows upsert request to any URL that identifies a single entity. It then references section 11.4.2 Create an Entity, which only talks about creating entities in a collection

          Clarify that upsert is also valid along a nullable single-valued navigation property, at least as long the key property values are client-defined. May also work with server-defined keys by responding with 201 and a location header with the canonical URL of the newly created entity.
          Section 11.4.4 Upsert an Entity allows upsert request to any URL that identifies a single entity. It then references section 11.4.2 Create an Entity, which only talks about creating entities in a collection.
          Environment Proposed
          mikep Michael Pizzo (Inactive) made changes -
          Proposal Clarify that upsert is also valid along a nullable single-valued navigation property.

          If the key property values are client-defined, this is straight-forward.

          If the key values are server-generated, the client can specify a key value, in which case the identified target is related and updated with provided non-key property values. And the client can omit the key properties, in which case a new entity is created from the provided property values and then related.
          Clarify that upsert is also valid along a nullable single-valued navigation property.

          If the key property values are client-defined, this is straight-forward.

          If the key values are server-generated, the client can specify a key value, in which case the identified target is related and updated with provided non-key property values. And the client can omit the key properties, in which case a new entity is created from the provided property values and then related.

          See wording for handling of deep updates: http://docs.oasis-open.org/odata/odata/v4.01/cs01/part1-protocol/odata-v4.01-cs01-part1-protocol.html#sec_UpdateRelatedEntitiesWhenUpdatinganE
          handl Ralf Handl made changes -
          Proposal Clarify that upsert is also valid along a nullable single-valued navigation property.

          If the key property values are client-defined, this is straight-forward.

          If the key values are server-generated, the client can specify a key value, in which case the identified target is related and updated with provided non-key property values. And the client can omit the key properties, in which case a new entity is created from the provided property values and then related.

          See wording for handling of deep updates: http://docs.oasis-open.org/odata/odata/v4.01/cs01/part1-protocol/odata-v4.01-cs01-part1-protocol.html#sec_UpdateRelatedEntitiesWhenUpdatinganE
          Clarify that upsert is also valid along a nullable single-valued navigation property.

          If the key property values are client-defined, this is straight-forward.

          If the key values are server-generated, the client can specify a key value, in which case the identified target is related and updated with provided non-key property values. And the client can omit the key properties, in which case a new entity is created from the provided property values and then related. If the client specifies a key value for which no entity exists, the request fails.

          See wording for handling of deep updates: [http://docs.oasis-open.org/odata/odata/v4.01/cs01/part1-protocol/odata-v4.01-cs01-part1-protocol.html#sec_UpdateRelatedEntitiesWhenUpdatinganE]
          handl Ralf Handl made changes -
          Description Section 11.4.4 Upsert an Entity allows upsert request to any URL that identifies a single entity. It then references section 11.4.2 Create an Entity, which only talks about creating entities in a collection. Section 11.4.4 Upsert an Entity allows upsert request to any URL that identifies a single entity. It then references section 11.4.2 Create an Entity, which only talks about creating entities in a collection.

          This question also arises in the context of "deep update" with nested entities for single-valued navigation.
          mikep Michael Pizzo (Inactive) made changes -
          Proposal Clarify that upsert is also valid along a nullable single-valued navigation property.

          If the key property values are client-defined, this is straight-forward.

          If the key values are server-generated, the client can specify a key value, in which case the identified target is related and updated with provided non-key property values. And the client can omit the key properties, in which case a new entity is created from the provided property values and then related. If the client specifies a key value for which no entity exists, the request fails.

          See wording for handling of deep updates: [http://docs.oasis-open.org/odata/odata/v4.01/cs01/part1-protocol/odata-v4.01-cs01-part1-protocol.html#sec_UpdateRelatedEntitiesWhenUpdatinganE]
          PUT or PATCH to a single-valued navigation property *reference* (i.e., customers/salesperson/$ref) MUST only include the entity id, and changes which entity is referenced by the navigation property.

          PUT or PATCH to a single-valued navigation property (i.e., customers/salesperson) performs an update on the currently related resource. If the value of the navigation property is non-null then any key values are ignored and the referenced entity is updated. If the value of the navigation property is null, for a containment relationship a resource is created (since the single-valued navigation path identifies the resource). For a non-containment relationship, PUT or PATCH to a null single-valued navigation property returns an error.

          The same semantics apply to singletons on the entity container, which are semantically contained single value navigation properties.
          mikep Michael Pizzo (Inactive) made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          handl Ralf Handl made changes -
          Environment Proposed Applied
          handl Ralf Handl made changes -
          mikep Michael Pizzo (Inactive) made changes -
          Status Applied [ 10002 ] Closed [ 6 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              handl Ralf Handl
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: