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
bug

Comments

@mikepizzo
Copy link
Member

@mikepizzo mikepizzo commented Sep 1, 2016

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

@chinadragon0515 chinadragon0515 commented Sep 2, 2016

@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

@chinadragon0515 chinadragon0515 commented Sep 21, 2016

Sample is updated, close the issue.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.