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

Problem with circular dependecies #28

Open jacek-lapinski opened 6 years ago

jacek-lapinski commented 6 years ago

I want to have a model with circular dependencies. Something like this: Product { category: Category }

Category { products: Product[] }

I prepared this model using annotations and plain classes, but it generates incorrect metadata. Type of navigation property products is Collection. It should be Collection(Product).

When I used previous version of your library it started to working ok.

Incorrect metadata for: "odata-v4-mongodb": "^0.1.12", "odata-v4-server": "^0.2.10"

Correct metadata for: "odata-v4-mongodb": "^0.1.9", "odata-v4-server": "^0.1.38"

Maybe I should generate my model using different approach? Can you help me?

lazarv commented 6 years ago

Hi @jacek-lapinski, this model is working as expected: https://github.com/jaystack/odata-v4-server/blob/master/src/example/model.ts Category EntityType includes <NavigationProperty Name="Products" Type="Collection(Northwind.Product)" Partner="Category"/> How you implemented your model? How you used the decorators to annotate the OData types?