angular-odata icon indicating copy to clipboard operation
angular-odata copied to clipboard

value is undefined

Open NiBurhe opened this issue 6 years ago • 7 comments

Hi,

I tried to generated the config files and call the Webservice. I got a correct reply with d as values. But I got the error below. Because body["value"] is undefined but body["d"] should be the correct one. Did I something wrong in the configuration?

image

I called it with

let person = this.user.entities(); person.filter({ Username: 'XXXX' }); person.get().subscribe((t) => { debugger; console.log(t); });

Thanks & Regards

NiBurhe avatar Jul 22 '20 12:07 NiBurhe

Hi @NiBurhe What is in the answer inside d? it is strange, the standard says that the answer for a collection is of the form {..., value: [...]} How is the backend implemented? What version of OData do you work with? the library is tightly tied to version 4 it is in this version that I use it for my projects. regards

diegomvh avatar Jul 22 '20 18:07 diegomvh

Hi @diegomvh ,

I checked with my colleagues and it is version 2.0

https://www.odata.org/documentation/odata-version-2-0/json-format/

In version 2.0 it is d

In the response header is an entry "dataserviceversion" which says 2.0

Is there a possibility to build in a switch to enable version 2.0 too?

Thanks & Regards

NiBurhe avatar Jul 23 '20 07:07 NiBurhe

After looking the documentation for OData version 2. I think it is possible to implement a processing mechanism for the reported odata versions using the response headers.

I am currently working on refactoring the response process and subsequent data parsing. The idea is to analyze the headers in the response and improve the pre-processing of the data deserailization.

I try to work with the idea of ​​supporting the other versions of odata, at least as far as the shape of the answer is concerned. Likewise, I do not know whether to consider version 2 or 3 of odata as a priority because, as it is not part of my projects, it is unknown to me in many aspects.

Regards

diegomvh avatar Jul 23 '20 19:07 diegomvh

Hi, @NiBurhe

I found an api that works with version 2.0 of odata. https://baas-demo.demo-jp.personium.io/1/index.html

I try to work on it to adapt the library. It is difficult to find public odata APIs.

Regards

diegomvh avatar Jul 28 '20 12:07 diegomvh

Hi @diegomvh ,

sounds good. Many Thanks

NiBurhe avatar Jul 28 '20 12:07 NiBurhe

Fighting with versions

https://github.com/diegomvh/AngularODataEntity/blob/0c373f2637415ccd339ad7e2ede80479e8b27c97/src/app/app.module.ts#L44

diegomvh avatar Aug 03 '20 22:08 diegomvh

The new release incorporates basic support for OData versions 3 and 2. Thanks for giving a try to the library. Regards

diegomvh avatar Aug 07 '20 18:08 diegomvh