Skip to content
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

Is https://services.odata.org/V2/(S(readwrite))/OData/OData.svc V1 or V2? #119

Open
boghyon opened this issue Aug 24, 2019 · 2 comments
Open
Labels

Comments

@boghyon
Copy link

boghyon commented Aug 24, 2019

The Reference Services page lists several OData V2 sample services. The description of the 2nd service says the following:

A simple OData v2 service optimized for quick browser demos.

https://www.odata.org/odata-services/#2

Also the DataServiceVersion in $metadata is 2.0 which suggests that the service is OData V2.

However: the format of entity collections conforms more OData V1 rather than V2.
See, for example, https://services.odata.org/V2/(S(readwrite))/OData/OData.svc/Products?$format=json:

{
 "d" : [ 
   { ... }, 
   { ... }, 
   { ... }, 
 ]
}

According to the spec:

6. Representing Collections of Entries

Collections represent a set of Entries. In OData v1, Collections are represented as an array of objects, with one object for each Entry within the Collection. For example, a collection of Entries would be represented as shown below. The format of each object in the array is described in the Representing Entries section. In OData v2, Collections are still represented as arrays, however to enable representing Collection-level metadata, the array of objects representing the set of Entries is included as the value of a "results" name/value pair.

OData V1: { 
  "d" : [ 
    { ... }, 
    { ... }, 
    { ... }, 
  ] 
} 
OData V2: { 
  "d" : { 
    "results":  [ 
      { ... }, 
      { ... }, 
      { ... }
    ] 
  }
}

So the question is: is the above mentioned service OData V1 or V2?

@boghyon
Copy link
Author

boghyon commented Aug 26, 2019

With $inlinecount=allpages, I can see the "results" property, which suggests that the service is supposed to be V2. However, requesting a collection without such queries still results in { "d": [...] } which is a V1 format. Such inconsistency leads to issues on the client side. See for example stackoverflow.com/q/43661554.

@boghyon
Copy link
Author

boghyon commented May 18, 2022

@KanishManuja-MS @mikepizzo Please see also the related issue #154

@boghyon boghyon changed the title Is https://services.odata.org/V2/(S(readwrite))/OData/OData.svc V1 or V2? Is https://services.odata.org/V2/(S(readwrite))/OData/OData.svc V1 or V2? Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants