Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PATCH semantics against complex types is incorrect #505

Closed
mikepizzo opened this issue Sep 1, 2016 · 2 comments
Closed

PATCH semantics against complex types is incorrect #505

mikepizzo opened this issue Sep 1, 2016 · 2 comments
Assignees
Labels

Comments

@mikepizzo
Copy link
Member

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.

@chinadragon0515
Copy link
Contributor

@mirsking I merge the PR to build new release. Help to update the hosted sample services on odata.org and sample services in odatasamples git repository.

@chinadragon0515
Copy link
Contributor

Sample is updated, close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants