Skip to content

PUT operation leaves derived type properties unchanged when not included in payload #1536

@Justinlcx

Description

@Justinlcx

Assemblies affected
ASP.NET Core OData 9.3.0

Describe the bug
When performing a PUT operation on an entity with a derived type, properties specific to the derived type that are not included in the request payload are not reset to their default values. Instead, they retain their previous values if the entity instance is more derived than the Delta type. It is unclear if this is by design or an implementation oversight, as the OData specification (v4.01 Section 11.4.3) states that omitted properties should be set to their default values, but does not explicitly call out behavior for properties present only on a more derived type than the tracked Delta.

Reproduce steps

  1. Define a base class and a derived class with additional properties.
  2. Create an entity of the derived class and persist it with non-default values for derived properties.
  3. Send a PUT request targeting the base type or a less-derived Delta that omits the derived properties from the payload.
  4. Observe that the derived properties are not reset.

Data Model

Repo

Expected behavior
All omitted properties, including those specific to the derived type, should be reset to their default values as per OData PUT semantics.

Screenshots

Image

Additional Context

Additional context
It appears that omitted properties in the derived type are not present in the Delta's updateChangedProperty and updateUnchangeProperty sets, so they are neither reset during PUT.
Is this behavior intentional or a bug?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions