diegomvh / angular-odata

Client side OData typescript library for Angular
https://www.npmjs.com/package/angular-odata
MIT License
50 stars 14 forks source link

value is undefined #13

Closed NiBurhe closed 4 years ago

NiBurhe commented 4 years ago

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

diegomvh commented 4 years ago

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

NiBurhe commented 4 years ago

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

diegomvh commented 4 years ago

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 commented 4 years ago

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

NiBurhe commented 4 years ago

Hi @diegomvh ,

sounds good. Many Thanks

diegomvh commented 4 years ago

Fighting with versions

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

diegomvh commented 4 years ago

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