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

Should return 204 for null entity from nullable single navigation property #288

Closed
lewischeng-ms opened this issue Feb 3, 2016 · 4 comments
Assignees
Labels

Comments

@lewischeng-ms
Copy link
Contributor

Thanks Petr Slavik for reporting this issue.

Here is what spec says:

11.2.6 Requesting Related Entities

To request related entities according to a particular relationship, the client issues a GET request to the source entity’s request URL, followed by a forward slash and the name of the navigation property representing the relationship.
If the navigation property does not exist on the entity indicated by the request URL, the service returns 404 Not Found.
If the relationship terminates on a collection, the response MUST be the format-specific representation of the collection of related entities. If no entities are related, the response is the format-specific representation of an empty collection.
If the relationship terminates on a single entity, the response MUST be the format-specific representation of the related single entity. If no entity is related, the service returns 204 No Content

Example 59: return the supplier of the product with ID=1 in the Products entity set
http://host/service/Products(1)/Supplier

Now RESTier returns 404 which is incorrect.

@chinadragon0515
Copy link
Contributor

Need to consider these cases:
entityset(existKey)/NonExistProp
entityset(existKey)/SingleValuePropWithValue
entityset(existKey)/SingleValuePropWithoutValue
entityset(nonexistKey)/SingleValueProp
entityset(existKey)/CollValuePropWithValue
entityset(existKey)/CollValuePropWithoutValue
entityset(nonexistKey)/CollValueProp

@chinadragon0515
Copy link
Contributor

Now LINQ can not return different result when entity does not exist vs property value is empty, we will need additional query to differentiate 404 vs 204 return code, move it to backlog per internal discussion and will check whether there is a better way on this part.

@chinadragon0515
Copy link
Contributor

Jeff from Oregon Youth Authority has requested this item.
"This is a nasty bug that causes the Microsoft OData client to throw an exception simply by trying to load navigation property."

@chinadragon0515
Copy link
Contributor

code merged, 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

2 participants