Skip to content

PATCH semantics against complex types is incorrect #505

@mikepizzo

Description

@mikepizzo

PATCH against a complex typed property is currently being handled with PUT semantics -- properties not specified in the payload are being set to null, where they should be left untouched.

Reproduce steps

PATCH http://services.odata.org/TripPinRESTierService/(S(h0jbxldzeiopthtrxz5zzme5))/Airports('KLAX')
{
"Location":{
"Address":"1 World Way, Los Angeles, CA, 90045","City":{
"Region":"CA"
}
}
}

Expected result

Only the Region of the City property should be changed to "CA"; the rest of the payload should remain unchanged.

Actual result

The other properties of Location are set to null:
{
"@odata.context":"http://services.odata.org/TripPinRESTierService/$metadata#Airports/$entity",
"Name":"Los Angeles International Airport",
"IcaoCode":"KLAX",
"IataCode":"LAX",
"Location":{
"Address":"1 World Way, Los Angeles, CA, 90045",
"City":{
"Name":null,
"CountryRegion":null,
"Region":"CA"
},
"Loc":null
}
}

Additional details

PATCH http://services.odata.org/TripPinRESTierService/(S(h0jbxldzeiopthtrxz5zzme5))/Airports('KLAX')
{
"Name":"Los Angeles International Airport"
}
Correctly only updates the Name property; the problem only appears if the payload contains a subset of the properties of a complex type.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions