We migrated to webapi 2 and $expand is not working anymore on collections. We are using NHibernate with breeze 1.4.7.
When we try to expand a collection, it simply returns an empty array. The odd part is that the generated sql follows the usage of the expand keyword.
The same code is working as expected with web api v1
Is it a bug in the web api 2 version of breeze?
This is a bug. MS changed some of the OData handling in WebApi 2, and our NH support didn't change with it.
The fix is in 1.4.8 (expected to be out tomorrow). We apologize for the inconvenience.
Related
I can see that OData v4 has support for reducing the metadata/urls that get returned, but I was wondering if OData v2 supports anything. I cannot see anything in the spec, but not sure if I just missed it or not.
No, OData v2 simply does not have a lightweight JSON serialization.
What is the best way of documenting OData endpoints?
Is there a way to use Swashbuckle for it?
Yes, try Swashbuckle.OData. It adds Swashbuckle support for ODataControllers.
See it in action here: http://swashbuckleodata.azurewebsites.net/swagger
Yes, we are trying to support it like yaml -> Swagger, yaml -> csdl ..
But it will need time to implementation, you can see a prototype and track there https://github.com/OData/model-first
I actually got something working for this using the IDocumentFilter function within Swashbuckle. I answered a similar question on the GitHub repo for Swashbuckle. Check out my response here (it's either at bottom or toward bottom):
https://github.com/domaindrivendev/Swashbuckle/issues/149
I've posted an example of a working IDocumentFilter implementation that you could leverage to get your OData endpoint set up in the Swagger ui.
Asp NET and Asp NET Core Api Versioning
You can use Api Versioning (as it extends ApiExplorer with Odata information) for both WebApi and AspNetCore.
There are samples available for both:
WebApi
Asp Net Core
This sample how it integrates well with Swashbuckle/Swagger ui.
The easiest way to do that I found is to convert OData definition to Open API spec using https://github.com/oasis-tcs/odata-openapi
Then import the spec document into swagger is very easy.
I was trying to use OpenUI5 with a .NET OData v4 Web API service. It looks like the client embeds the "Max OData Service Version" header with the HTTP request by default and my service doesn't like that. Additionally, documentation notes support for v2 experimental v3.
Does anyone know when support for v4 is expected?
Thanks so much!
There are people working on the v4 support, but don't expect it to be available in the next few months.
Currently a new version of the v2 model is being implemented that has performance optimizations and better batch support, after that one is finished I guess the v4 support will be an important part of the agenda.
OData V4 finaly just got released.
https://sapui5.netweaver.ondemand.com/sdk#docs/api/symbols/sap.ui.model.odata.v4.ODataModel.html
But keep in mind what Jens Ittel said:
[...] Due to its limited feature scope, we will not recommend to use
the first of these releases of the model implementation for productive
usage. [...]
Can a Breeeze ApiController support ODATA clients for read-only access, now that Microsoft have added ODATA support for WebAPI?
We are working on doing exactly this. Hopefully, we should have a release out with this ability within the next two weeks. I will post back here when it is available.
I followed Getting started with WCF Web API.
Everything works well and it supports some of the operators like
?$filter=Name eq 'Ajay'
?$top=4
But when I try other queries like
$filter=substringof('Ajay', Name)
OR
$filter=length(Name) gt 5
It gives following error
The server encountered an error processing the request. See server logs for more details.
But same queries work well with other ODATA services like Netflix. Does WCF Web API support only a limited set of queries, or I am missing something?
Yes preview 4 only supports a subset of the OData query options. However, there is a new Preview 5 available as of last week and it has additional OData support. I'm not sure if all of the query options are now supported but it is worth checking out.