Skip to content

OData V4

Martin Miksik edited this page Oct 4, 2019 · 74 revisions

Protocol

  • "Custom functions defined with the new CSDL element Function may be used in $filter and $orderby expressions" Is there any reason user could not do that with our client? (Test 1081, Service 902) How does it work? What can we pass? - let's keep it this way for now
  • "Asynchronous Processing and Notification Callback," I think this is not mission-critical for now.
  • "Common Response Status Codes" More of serverside thing, isn't it? 1

Requesting Data

  • In addition to the monolithic XML metadata document services now can provide metadata as an OData service with root URL "~/$metadata/" with a fixed structure

  • "$inlinecount=allpages has been shortened to $count=true." Can't see that in our client.

  • $search has been added. Not sure what is the exact difference to the $filter. V2 SAP? => search is fulltext on all values

  • $expand - can be filtered

  • $levels - expansion for a specific number of levels

  • "Use PATCH instead of PUT". I think we are already doing it. (test_update_entity)

Operations

  • "Actions and functions are now declared on the schema level" In V2 Functions were called FunctionImports, see if there are other differences
  • Good resource
  • "New: No Redundant Keys for Dependent Entities" dunno how was it done in V2 and I can't find the answer on google nor in the tests.
  • Addressing References via /$ref, Resolving References via "/$entity?$id", Cross-Join Queries via "/$crossjoin"
  • Virtual Collection ~/$all
  • Remember in V2 -> optional return type, V4 -> has to have return type
  • Functions -> only get data. Actions -> can edit data
  • Function are either bound to something(e. g. entity) or not. For example, unbound functions are used in queries. See for more details
  • Action and Function import means it can be called from root url

Schema

  • added Alias attribute

Metadata

  • edmx - edmx:Include and edmx:IncludeAnnotations

The edmx:Reference element contains zero or more edmx:IncludeAnnotations elements that specify the annotations to include from the target document. If no edmx:IncludeAnnotations element is specified, a client MAY ignore all annotations in the referenced document that are not explicitly used in an edm:Path expression of the referencing document.

  • We should not download data for the user from the internet, therefore, config should provide the location of pre-downloaded documents otherwise an exception should rise.
  • Config, if include -> what to do

Changes in types - see

  • DateTime is surpassed by DateTimeOffset
  • Edm.Time is surpassed by Edm.Duration and Edm.TimeOfDay
  • Edm.Date has been added
  • Edm.GeographyPoint has been added?
  • Edm.Untyped
  • Edm.Float has been deprecated
  • Added Type Definitions - create a new type by inhering primitive type
  • Added "Abstract Types" - The actual type is specified at runtime in the payload using the context URL or the type annotation.

Types table

EDM Type Included in V2 Included in V4
Edm.Binary ✔️ ✔️
Edm.Boolean ✔️ ✔️
Edm.Byte ✔️ ✔️
Edm.Date ✔️
Edm.DateTime ✔️
Edm.DateTimeOffset ✔️ ✔️
Edm.Decimal ✔️ ✔️
Edm.Double ✔️ ✔️
Edm.Duration ✔️
Edm.Guid ✔️ ✔️
Edm.Int16 ✔️ ✔️
Edm.Int32 ✔️ ✔️
Edm.Int64 ✔️ ✔️
Edm.SByte ✔️ ✔️
Edm.Single ✔️ ✔️
Edm.Stream ✔️
Edm.String ✔️ ✔️
Edm.TimeOfDay ✔️
Edm.Time ✔️
Edm.Geography ✔️
Edm.GeographyPoint ✔️
Edm.GeographyLineString ✔️
Edm.GeographyPolygon ✔️
Edm.GeographyMultiPoint ✔️
Edm.GeographyMultiLineString ✔️
Edm.GeographyMultiPolygon ✔️
Edm.GeographyCollection ✔️
Edm.Geometry ✔️
Edm.GeometryPoint ✔️
Edm.GeometryLineString ✔️
Edm.GeometryPolygon ✔️
Edm.GeometryMultiPoint ✔️
Edm.GeometryMultiLineString ✔️
Edm.GeometryMultiPolygon ✔️
Edm.GeometryCollection ✔️

What about float?

Structural Properties

  • Removed: Collation -> it seems it has been added in V3
  • Removed: FixedLength -> it seems it has been added in V3
  • Removed: ConcurrencyMode -> it seems it has been added in V3. Replaced by Core.OptimisticConcurrencyControl?
  • Removed: StoreGeneratedPatern -> it seems it has been added in V3. Replaced by Core.Computed?

Navigation Properties

  • Removed: Association, FromRole, ToRole - plugin architecture?
  • Added: Navigation Property Bindings -> replacment for Associations sets
  • Added: Type(e. g. Self.Category, Collection(Self.Product))
  • Added: Nullable
  • Added: Partner - bidirectional relations => tied with "Type"
  • Added: edm:ReferentialConstraint => "Does this category exest?" Sure it must, if I am using its value.
  • Added: OnDelete -> Like Doctrine 2 cascade delete

Entity Types

Complex Types

  • Added: Navigation Properties

Service Document

  • what is it? There were few changes in its design, mostly regarding annotations.

EntityContainer

  • Only one Entity container is allowed now.
  • IsDefaultEntityContainer is removed. Dunno if it affects our client.
  • There are quite a few changes to annotations, but since we hardly support them now I suggest to now bother to implement them from start and rather add the support later.

JSON

  • What is: **"__metadata": { ** **"uri": "https://services.odata.org/OData/OData.svc/Categories(0)",** **"type": "DataServiceProviderDemo.Category" ** **}, and why we don't have it. **

  • Request payloads in JSON do not require context URLs. It MAY be included as a base URL for relative URLs in the request payload. Response payloads SHOULD NOT contain the context URL if odata.metadata=none is requested. "@odata.context": "http://host/service/$metadata#Customers/$entity"

  • note to me: "What the hell is @id?"


Not sure if V4 is a new protocol or only purged almost everything V3 added.

Self.??????? http://docs.oasis-open.org/odata/odata/v4.0/cs01/part3-csdl/odata-v4.0-cs01-part3-csdl.html#_Toc365046571 7 Navigation Property

Resources

Clone this wiki locally