-
Notifications
You must be signed in to change notification settings - Fork 88
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
OData v4 support #39
Comments
+1 |
I really really need OData v4 support in order to move forward on a very important project. I just started hacking on the olingo odatajs library and I am putting together my own Breeze adapter to work with it. I've only been working on it for a few hours so far but I got GET requests seemingly working okay. If this proves to be robust and useable, I will publish it somewhere. |
Do stay in touch on that. |
Is official breeze support something we should hope to see fairly soon? |
@wardbell sure thing. I've currently implemented the "read" side of things - it is working with the usual Breeze query methods like expand() and skip() and so on and links up the entities where relationships exist. I'm currently working on write functionality - unfortunately the server API has not yet implemented batch mode so I am just waiting on that before I continue (hopefully it's working in the next day or so). |
For anyone interested, I have made a repo with my progress so far. note it's a quick-and-dirty hack of the existing adapter at the moment, don't judge me! 😉 https://github.com/michaelbromley/breezejs-odata4-adapter Contribution is very welcome! |
Thanks @michaelbromley this is hugely appreciated - even more so, considering IdeaBlade would not appear to have any immediate plans to support the standard. |
+1 |
+10 |
+1 |
1 similar comment
+1 |
+10086 |
Is there an ETA for when OData v4 will be supported yet? |
We are working on it now. We've been talking to the Microsoft OData team about lingering issues on their end that prevent us from proceeding ... or at least we don't want to move forward until we know what our path will be and what guidance we can give to you. They've been very helpful and responsive and that has been great. I feel we'll have some good news soon. |
Hi Ward thanks for the info, We are keen to use breeze as it looks great, do you have any feeling for timeframes, 1 month, 3 months, 6 months, longer? |
I have a feeling it will be 1 to 2 months. Not a commitment. But I'll be surprised and disappointed if it takes 2 months. We have options even if they aren't preferred options. HTH |
Thanks Ward that is great info, much appreciated. |
Thanks @wardbell, I understand these things take time, especially when it comes to dealing with issues with the implementation of the new specification and I will voice my appreciation for your persistence! This has been a long time coming for me. |
Hi, is there any update on when this may be available please? |
+1 : it's rather odd that OData v4 has been out for so long and breeze still doesn't support it. When is this happening?? |
I've created an updated OData V4 adapter based on the one from @michaelbromley that I have successfully integrated with ASP.NET WebApi OData 4: https://github.com/tschettler/breezejs-odata4-adapter Fixes:
Not tested:
The adapter logic still needs some commenting and general cleanup, but I hope this helps someone. -- Travis |
Hi Travis (@tschettler), Regards, |
Glad to hear it helped you @hemantsathe! I don't think it would be too difficult to cache the metadata, are you thinking of caching using localStorage or along those lines? I save the metadata to a local variable before I give it to breeze so that I can pass it back to odatajs for the $batch operation. With a little effort, you could check for a cached version of the metadata in the fetchMetaData function, before the odatajs.oData.read call. |
Thanks @tschettler . Will try that. I am getting an error on line 210 at schema.entityContainer.entitySet.find where find on an array is undefined. Are you using any library for this this function? This looks like ECMA2015 feature in JavaScript. [Update] I changed the find function calls to filter and also returned the zeroth element from the result if available. This made the code work. There is a bug in breeze though. It processes the Guid values as guid'<guid-value>' whereas OData V4 expects only plain guid-value without quotes. I fixed both these changes on my side and most of the stuff is working. There are few changes in syntax between v3 and v4 but those should not be blocking. Regards, |
Fixes formatting for OData V4 primitives, based on the new JSON format, issue referenced in Breeze/breeze.js#39 (comment)
Thanks @hemantsathe, You're right, sorry about that, there was a polyfill function. I changed it to use breeze.core.arrayFirst, in two places that were using it. tschettler/breezejs-odata4-adapter@f9785e4 The OData formatting issue you see with guids would also be present with any other primitives that use the verbose JSON format. I've updated the adapter to register new fmtOData functions for the affected data types. tschettler/breezejs-odata4-adapter@f4a333a I tested a couple of the data types. There are likely still some issues present, but this will provide a way to configure the correct formats from the adapter. |
hi @wardbell any news on the official support of V4? |
hi there, we are also waiting to use odata v4 together with breeze. are there any news you can share here regarding the integration? thanks in advance... chris |
@tschettler @muchaelbromley @wardbell @hemantsathe Any updatee here guys? I have been trying go use your custom adapter also but things are not moving forward in my code... Not sure how/what extra configuration you are having to make breeze work with odata v4. Please let me know if there is anything I am missing. I run into issue of 'require()' not defined as soon as I try to initialize above mentioned adapter even afterr having q.js. |
@ssiwach8 Are you using the custom odatajs-4.0.0.js file from my forked adapter? The version from Apache registers the require() function into the global scope, so I have wrapped the initialization logic in an IIFE in the custom version. See the Usage section of the readme for more details. The only other thing I've had to do is define odatajs in requirejs, I suppose you may need to do something similar if you are using a different AMD loader:
Can you provide more information on the error you are getting? |
@tschettler Yes I have downloaded both the files from your fork only. I got rid of the 'require not defined' error now but my Metadata query is still failing. Everything seems fine till the execution reaches Line # 84 of breezeOdataV4Adapter.js where after making the metadata read call it falls into its error promise section and displays an alert giving error as shown below: "Error: Metadata query failed for: http://mysite/webapi/odata/$metadata;" In fiddler it shows that the header for this is 'HTTP/1.1 405 Method Not Allowed'. |
Hi @ssiwach8, this is correct and has nothing to do with breeze. This comes from the pre-flight request (CORS-related, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Preflighted_requests). You have to allow the verb OPTIONS via header field "Access-Control-Allow-Methods" on your server where the API runs. Cheers, |
Hey,
--batch_d482-0e88-a8e7 --changeset_c141-fe65-2290 POST GCCP.WebAPI/odata/NoticeText HTTP/1.1 { "entityData": "to be sent to server" } --batch_d482-0e88-a8e7-- Please suggest where and how I should make changes to insert an entity into my entity set named 'NoticeText' here? This weekend is all I have to prove the concept else the project architecture will move in different direction dropping breeze out of the picture. |
I apologize for the issues, I basically just got it working for my own use without additional testing yet. You should be able to do what you need for identities without changing breeze. Try getting the entityType from the metadataStore and then calling setProperties on it. Something like:
Also, the adapter uses batch requests, so you would need to enable batch routing in your WebApi. If you are using ASP.NET WebApi 2, this article lists configuring the OData endpoint for batch requests: |
any news regarding breeze official support for odatav4? |
+10000000 |
From Oct 7, 2014 until now and still no OData 4 Support. |
+1 |
If you do want to use breeze with OData 4, check out my OData 4 adapter, it has worked very well for me: https://github.com/tschettler/breezejs-odata4-adapter It's a work in progress, but I plan to keep supporting it until breeze gets official OData 4 support. |
Any word on BreezeJS support for OData v4? |
??? |
I'm currently searching for javascript datasource for a new project, one of the requirements is odata v4, is odata v4 officially supported by breeze? I saw a bunch of optional libraries/wrappers/forks from contributors and don't get me wrong I'm very thankful but would be awesome if it was officially supported. |
While breeze.js does not currently support OData 4, I've been actively developing a library with the goal to enable full OData 4 support for the existing breeze.js library: https://github.com/tschettler/breeze-odata4 It's a work in progress, but it already has support for many OData 4 features. You're welcome to give it a try and let me know what you think. |
3 years. |
Looks like there is a beta out for odatajs which gives OData v4 support to javascript.
http://olingo.apache.org/doc/javascript/
https://github.com/apache/olingo-odata4-js/tree/master/odatajs
We'd love to use OData v4 as it has many improvements over OData v3 which is what breeze (and any other js library) supports right now.
The text was updated successfully, but these errors were encountered: