jaystack / odata-v4-server

With JayStack OData v4 Server you can build your own data endpoints without the hassle of implementing any protocol-level code. This framework binds OData v4 requests to your annotated controller functions, and compiles OData v4 compatible response. Clients can access services through OData-compliant HTTP requests. We recommend the JayData library for consuming OData v4 APIs.
https://jaystack.com/products/jaystack-odata-v4-server/
75 stars 55 forks source link

?$expand does not work properly #29

Open nigel-dewar opened 6 years ago

nigel-dewar commented 6 years ago

Expand seems to be broken on both of these examples

https://github.com/jaystack/odata-v4-server-mongodb-example https://github.com/jaystack/odata-v4-server-mssql-example

If you visit http://services.odata.org/V4/ samples and use the following url

http://services.odata.org/V4/(S(ggb5l0d13uzsg0ro2qgrpoa4))/TripPinServiceRW/People?$expand=Trips

You will see you can get People and also their Trips

But if you try to do a similar query with odata-v4-server it breaks. For example

this breaks

http://localhost:3000/Products?$expand=Category

The console pumps out this error ( Im using the SQL server example in this case )

image

(node:10068) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'length' of undefined
(node:10068) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I can see the navigation property for Category is indeed there image

Is this a bug, or am I not using this navigation property the way its intended? Is there some kind of Containment property that needs to be included on the NavigationProperty?

I did notice the navigation property in the services.odata.org sample is different, and includes a ContainsTarget property.

image

My details

Windows 10 Pro x64 Node version 8.1.1 npm version 5.0.3

The MS SQL Server sample has the following dependencies

"devDependencies": { "@types/express": "^4.0.34", "@types/mssql": "^3.1.30", "chai": "^3.5.0", "mocha": "^3.2.0", "mochawesome": "^1.5.4", "typescript": "^2.0.10" }, "dependencies": { "express": "^4.14.0", "msnodesqlv8": "^0.2.10", "mssql": "^3.3.0", "odata-v4-mssql": "^0.1.0", "odata-v4-server": "^0.1.15" }

aetherity commented 6 years ago

This is also true with the pgsql example.

RinatMullayanov commented 6 years ago

I have same problem.

quocvc commented 5 years ago

me too.

sgiraldo62 commented 5 years ago

I have same problem. HELP ME

hanyoujia commented 4 years ago

Does anyone find a way to solve this issue? please help