OData Common Schema Definition Language (CSDL) JSON ...



OData Common Schema Definition Language (CSDL) JSON Representation Version 4.01 Working Draft 0116 27 November January 20176Technical Committee:OASIS Open Data Protocol (OData) TCChairs:Ralf Handl (ralf.handl@), SAP SERam Jeyaraman (Ram.Jeyaraman@), MicrosoftEditors:Michael Pizzo (mikep@), MicrosoftRalf Handl (ralf.handl@), SAP SE Martin Zurmuehl (martin.zurmuehl@), SAP SEAdditional artifacts:This prose specification is one component of a Work Product that also includes:OData Common Schema Definition Language (CSDL) JSON Representation Version 4.0 (this document)JSON schemas; OData CSDL JSON schema. HYPERLINK "" . HYPERLINK "" csdl.schema.jsonRelated work:This specification is related to:OData Version 4.01. Edited by Michael Pizzo, Ralf Handl, and Martin Zurmuehl. A multi-part Work Product which includes:OData Version 4.01. Part 1: Protocol. Latest version:? Version 4.01. Part 2: URL Conventions. Latest version:? Common Schema Definition Language (CSDL) XML Representation Version 4.01. Edited by Michael Pizzo, Ralf Handl, and Martin Zurmuehl. Latest version: Vocabularies Version 4.0. Edited by Mike Pizzo, Ralf Handl, and Ram Jeyaraman. Latest version: . OData JSON Format Version 4.01. Edited by Ralf Handl, Michael Pizzo, and Mark Biamonte. Latest version:? XML namespaces:NoneAbstract:OData services are described by an Entity Data Model (EDM). The Common Schema Definition Language (CSDL) defines specific representations of the entity data model exposed by an OData service using XML, JSON, and other formats. This document (OData CSDL JSON Representation) specifically defines the JSON representation of the entity data model.Status:This Working Draft (WD) has been produced by one or more TC Members; it has not yet been voted on by the TC or approved as a Committee Draft (Committee Specification Draft or a Committee Note Draft). The OASIS document Approval Process begins officially with a TC vote to approve a WD as a Committee Draft. A TC may approve a Working Draft, revise it, and re-approve it any number of times as a Committee Draft.URI patterns:Initial publication URI: “Latest version” URI:(Managed by OASIS TC Administration; please don’t modify.)Copyright ? OASIS Open 2016. All Rights Reserved.All capitalized terms in the following text have the meanings assigned to them in the OASIS Intellectual Property Rights Policy (the "OASIS IPR Policy"). The full Policy may be found at the OASIS website.This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published, and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this section are included on all such copies and derivative works. However, this document itself may not be modified in any way, including by removing the copyright notice or references to OASIS, except as needed for the purpose of developing any document or deliverable produced by an OASIS Technical Committee (in which case the rules applicable to copyrights, as set forth in the OASIS IPR Policy, must be followed) or as required to translate it into languages other than English.The limited permissions granted above are perpetual and will not be revoked by OASIS or its successors or assigns.This document and the information contained herein is provided on an "AS IS" basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.Table of Contents TOC \o "1-4" \h \z \u 1Introduction PAGEREF _Toc473273078 \h 61.1 Terminology PAGEREF _Toc473273079 \h 61.2 Normative References PAGEREF _Toc473273080 \h 61.3 Non-Normative References PAGEREF _Toc473273081 \h 61.4 Typographical Conventions PAGEREF _Toc473273082 \h 62Design Considerations PAGEREF _Toc473273083 \h 72.1 Construction Principles PAGEREF _Toc473273084 \h 72.2 JSON Schema Definition PAGEREF _Toc473273085 \h 73CSDL JSON Document PAGEREF _Toc473273086 \h 83.1 Member $Reference PAGEREF _Toc473273087 \h 83.2 Member $Include PAGEREF _Toc473273088 \h 83.3 Member $IncludeAnnotations PAGEREF _Toc473273089 \h 94Schema PAGEREF _Toc473273090 \h 104.1 Member $Alias PAGEREF _Toc473273091 \h 104.2 Member $Annotations PAGEREF _Toc473273092 \h 105Entity Type PAGEREF _Toc473273093 \h 115.1 Member $BaseType PAGEREF _Toc473273094 \h 115.2 Member $Abstract PAGEREF _Toc473273095 \h 115.3 Member $OpenType PAGEREF _Toc473273096 \h 125.4 Member $HasStream PAGEREF _Toc473273097 \h 125.5 Member $Key PAGEREF _Toc473273098 \h 126Structural Property PAGEREF _Toc473273099 \h 146.1 Members $Type and $isCollection PAGEREF _Toc473273100 \h 146.2 Member $Nullable PAGEREF _Toc473273101 \h 146.3 Member $MaxLength PAGEREF _Toc473273102 \h 146.4 Member $Precision PAGEREF _Toc473273103 \h 146.5 Member $Scale PAGEREF _Toc473273104 \h 156.6 Member $Unicode PAGEREF _Toc473273105 \h 156.7 Member $SRID PAGEREF _Toc473273106 \h 156.8 Member $DefaultValue PAGEREF _Toc473273107 \h 157Navigation Property PAGEREF _Toc473273108 \h 167.1 Member $Type and $isCollection PAGEREF _Toc473273109 \h 177.2 Member $Nullable PAGEREF _Toc473273110 \h 177.3 Member $Partner PAGEREF _Toc473273111 \h 177.4 Member $ContainsTarget PAGEREF _Toc473273112 \h 177.5 Member $ReferentialConstraint PAGEREF _Toc473273113 \h 177.6 Member $OnDelete PAGEREF _Toc473273114 \h 178Complex Type PAGEREF _Toc473273115 \h 188.1 Member $BaseType PAGEREF _Toc473273116 \h 188.2 Member $Abstract PAGEREF _Toc473273117 \h 188.3 Member $OpenType PAGEREF _Toc473273118 \h 189Enumeration Type PAGEREF _Toc473273119 \h 199.1 Member $UnderlyingType PAGEREF _Toc473273120 \h 209.2 Member $IsFlags PAGEREF _Toc473273121 \h 2010Type Definition PAGEREF _Toc473273122 \h 2110.1 Member $UnderlyingType PAGEREF _Toc473273123 \h 2111Action and Function PAGEREF _Toc473273124 \h 2211.1 Action Overload PAGEREF _Toc473273125 \h 2211.2 Function Overload PAGEREF _Toc473273126 \h 2211.3 Member $IsBound PAGEREF _Toc473273127 \h 2211.4 Member $IsComposable PAGEREF _Toc473273128 \h 2211.5 Member $EntitySetPath PAGEREF _Toc473273129 \h 2211.6 Member $ReturnType PAGEREF _Toc473273130 \h 2311.6.1 Members $Type and $isCollection PAGEREF _Toc473273131 \h 2311.6.2 Member $Nullable PAGEREF _Toc473273132 \h 2311.7 Member $Parameter PAGEREF _Toc473273133 \h 2311.7.1 Member $Name PAGEREF _Toc473273134 \h 2311.7.2 Members $Type and $isCollection PAGEREF _Toc473273135 \h 2311.7.3 Member $Nullable PAGEREF _Toc473273136 \h 2312Entity Container PAGEREF _Toc473273137 \h 2412.1 Member $Extends PAGEREF _Toc473273138 \h 2412.2 Entity Set PAGEREF _Toc473273139 \h 2512.2.1 Member $IncludeInServiceDocument PAGEREF _Toc473273140 \h 2512.2.2 Member $NavigationPropertyBinding PAGEREF _Toc473273141 \h 2512.3 Singleton PAGEREF _Toc473273142 \h 2512.4 Action Import PAGEREF _Toc473273143 \h 2512.5 Function Import PAGEREF _Toc473273144 \h 2612.5.1 Member $IncludeInServiceDocument PAGEREF _Toc473273145 \h 2613Vocabulary and Annotation PAGEREF _Toc473273146 \h 2713.1 Term PAGEREF _Toc473273147 \h 2713.1.1 Member $Type and $isCollection PAGEREF _Toc473273148 \h 2713.1.2 Member $Nullable PAGEREF _Toc473273149 \h 2713.1.3 Member $AppliesTo PAGEREF _Toc473273150 \h 2713.2 Annotation PAGEREF _Toc473273151 \h 2713.3 Constant Expressions PAGEREF _Toc473273152 \h 2813.3.1 Binary PAGEREF _Toc473273153 \h 2813.3.2 Boolean PAGEREF _Toc473273154 \h 2813.3.3 Date PAGEREF _Toc473273155 \h 2813.3.4 DateTimeOffset PAGEREF _Toc473273156 \h 2813.3.5 Decimal PAGEREF _Toc473273157 \h 2813.3.6 Duration PAGEREF _Toc473273158 \h 2813.3.7 Enumeration Member PAGEREF _Toc473273159 \h 2913.3.8 Floating-Point Number PAGEREF _Toc473273160 \h 2913.3.9 Guid PAGEREF _Toc473273161 \h 2913.3.10 Integer PAGEREF _Toc473273162 \h 3013.3.11 String PAGEREF _Toc473273163 \h 3013.3.12 Time of Day PAGEREF _Toc473273164 \h 3013.4 Dynamic Expressions PAGEREF _Toc473273165 \h 3013.4.1 Comparison and Logical Operators PAGEREF _Toc473273166 \h 3013.4.2 Annotation Path Expression PAGEREF _Toc473273167 \h 3113.4.3 Apply Expression and Client-Side Functions PAGEREF _Toc473273168 \h 3213.4.3.1 Function odata.concat PAGEREF _Toc473273169 \h 3213.4.3.2 Function odata.fillUriTemplate PAGEREF _Toc473273170 \h 3213.4.3.3 Function odata.uriEncode PAGEREF _Toc473273171 \h 3313.4.4 Cast Expression PAGEREF _Toc473273172 \h 3313.4.5 Collection Expression PAGEREF _Toc473273173 \h 3313.4.6 If Expression PAGEREF _Toc473273174 \h 3313.4.7 Is-Of Expression PAGEREF _Toc473273175 \h 3413.4.8 Labeled Element Expression PAGEREF _Toc473273176 \h 3413.4.9 Labeled Element Reference Expression PAGEREF _Toc473273177 \h 3413.4.10 Null Expression PAGEREF _Toc473273178 \h 3413.4.11 Navigation Property Path Expression PAGEREF _Toc473273179 \h 3513.4.12 Path Expression PAGEREF _Toc473273180 \h 3513.4.13 Property Path Expression PAGEREF _Toc473273181 \h 3513.4.14 Record Expression PAGEREF _Toc473273182 \h 3613.4.15 URL Reference Expression PAGEREF _Toc473273183 \h 3614CSDL Examples PAGEREF _Toc473273184 \h 3714.1 Products and Categories Example PAGEREF _Toc473273185 \h 3714.2 Annotations for Products and Categories Example PAGEREF _Toc473273186 \h 4115Conformance PAGEREF _Toc473273187 \h 42Appendix A. Acknowledgments PAGEREF _Toc473273188 \h 43Appendix B. Revision History PAGEREF _Toc473273189 \h 44IntroductionOData services are described in terms of an Entity Data Model (EDM). The Common Schema Definition Language (CSDL) defines a representation of the entity data model exposed by an OData service using the JavaScript Object Notation (JSON), see?[ HYPERLINK \l "RFC7159" RFC7159].This format is based on the OpenUI5 OData V4 Metadata JSON Format, see [ HYPERLINK \l "OpenUI5" OpenUI5], with some extensions and modifications made necessary to fully cover OData CSDL Version 4.01. TerminologyThe key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [ HYPERLINK \l "RFC2119" RFC2119].Normative References[CSDL-Schema]OData CSDL JSON Schema. See link in “Additional artifacts” section on cover page.[CSDL-XML]OData Common Schema Definition Language (CSDL) XML Representation Version 4.01. See link in “Related work” section on cover page.[OData-JSON]OData JSON Format Version 4.01. ee link in “Related work” section on cover page.[OData-Protocol]OData Version 4.01 Part 1: Protocol. See link in “Related work” section on cover page.[OData-URL]OData Version 4.01 Part 2: URL Conventions. See link in “Related work” section on cover page.[RFC2119]Bradner, S., “Key words for use in RFCs to Indicate Requirement Levels”, BCP 14, RFC 2119, March 1997. HYPERLINK "" HYPERLINK "" .[RFC7159]Bray, T., Ed., “The JavaScript Object Notation (JSON) Data Interchange Format”, RFC 7159, March 2014. . [RFC7493]Bray, T., Ed., "The I-JSON Message Format", RFC7493, March 2015. References[OpenUI5]OpenUI5 Version?1.40.10 – OData V4 Metadata JSON Format, Typographical ConventionsKeywords defined by this specification use this monospaced font.Normative source code uses this paragraph style.Some sections of this specification are illustrated with non-normative examples.Example 1: text describing an example uses this paragraph styleNon-normative examples use this paragraph style.All examples in this document are non-normative and informative only.All other text is normative unless otherwise labeled. Design ConsiderationsOData CSDL JSON is a full representation of the OData Common Schema Definition Language in the JavaScript Object Notation (JSON) defined in [ HYPERLINK \l "RFC7159" RFC7159]. It additionally follows the rules for “Internet JSON” (I-JSON) defined in [RFC7493] for e.g. objects, numbers, date values, and duration values.Construction PrinciplesCSDL JSON documents are designed for easy and efficient lookup of model constructs by their unique namespace-qualified name, without having to know or guess what kind of model element it is. Thus all primary model elements (entity types, complex types, type definitions, enumeration types, terms, actions, functions, and the entity container) are top-level members of a CSDL JSON document, using the namespace-qualified name as the member name. Similarly child elements of primary model elements (properties, navigation properties, enumeration type members, entity sets, singletons, action imports, and function imports) are direct members of the objects describing their parent model element.To avoid name collisions, all fixed member names are prefixed with a dollar ($) sign and otherwise have the same name and capitalization as their counterparts in the CSDL XML representation [CSDL-XML] (with one exception: the counterpart of the EntitySet element’s EntityType attribute is $Type, to harmonize it with the corresponding attribute of the Singleton element).Additional fixed members introduced by this specification and without counterpart in [CSDL-XML] are prefixed with a dollar ($) sign and use lower-camel-case names. One of these is $kind which represents the kind of model element. Its values the upper-camel-case local names of the XML elements representing this kind of model element in [CSDL-XML], e.g. EntityType or NavigationProperty.While the XML representation of CSDL allows referencing model elements with alias-qualified names as well as with namespace-qualified names, this JSON representation solely relies on namespace-qualified names.JSON Schema DefinitionThe structure of CSDL JSON documents can be verified with the JSON Schema [CSDL-Schema] provided as an additional artifact of this prose specification. This schema only defines the shape of a well-formed CSDL JSON document but is not descriptive enough to define what a correct CSDL JSON document MUST be in every imaginable use case. This specification document defines additional rules that correct CSDL JSON documents MUST fulfill. In case of doubt on what makes a CSDL JSON document correct the rules defined in this specification document take precedence.CSDL JSON DocumentA CSDL JSON document consists of a single JSON object. This root object MUST contain a member $Version with a string value of 4.0 or 4.01.If the CSDL JSON document is the metadata document of an OData service, the root object MUST contain a member $EntityContainer. Its value is the namespace-qualified name of the entity container of that service.The root object MAY contain the member $Reference to reference other CSDL documents.It also MAY contain members for schemas and schema children defined in this document.Example 2:{ "$Version": "4.01", "$EntityContainer": "ODataDemo.DemoService", "$Reference": …, "ODataDemo.DemoService": …, … }Member $ReferenceThe value of $Reference is an object that contains one member per referenced CSDL document. The name of the pair is a URI for the referenced document. The URI MAY be relative to the document containing the $Reference.The value of each member is an object that MAY contain the members $Include and $IncludeAnnotations as well as annotations. Member $IncludeThe value of $Include is an array. Array items are either strings or objects.If a schema is included without annotations and without an alias, it is represented as a string whose value is the namespace of the included schema followed by a dot (.).If a schema is included with annotations or with an alias, it is represented as an object. This object contains a member whose name is the namespace of the included schema followed by a dot (.), and whose value is either a string containing the alias, or null if no alias is specified. Note: this alias is only for compatibility and for use in instance annotations within JSON message bodies, see [OData-JSON]. CSDL JSON documents only use namespace-qualified names to reference model constructs, they MUST NOT use alias-qualified names. The value object MAY contain annotations.Example 3: references to entity models containing definitions of vocabulary terms{ "$Reference": { "": { "$Include": [ "Org.OData.Capabilities.V1." ] }, "": { "$Include": [ { "org.example.Display.": "UI" } ] ] } }, …}Member $IncludeAnnotationsThe value of $IncludeAnnotations is an array. Array items are objects that MUST contain the member $TermNamespace and MAY contain the members $Qualifier and $TargetNamespace.The value of $TermNamespace is a namespace followed by a dot (.).The value of $Qualifier is a SimpleIdentifier.The value of $TargetNamespace is a namespace followed by a dot (.).Example 4: reference documents that contain annotations{ "$Version": "4.01", "$Reference": { "": { "$IncludeAnnotations": [ { "$TermNamespace": "org.example.validation." }, { "$TermNamespace": "org.example.display.", "$Qualifier": "Tablet" }, { "$TermNamespace": "org.example.hcm.", "$TargetNamespace": "com.example.Sales." }, { "$TermNamespace": "org.example.hcm.", "$Qualifier": "Tablet", "$TargetNamespace": "com.example.Person." } ] } }, …}SchemaA schema is represented as a member of the document object whose name is the schema namespace followed by a dot (.). Its value is an object that MAY contain a member $Annotations.The value object MAY contain annotations that apply to the schema itself.Example 5: document defining a schema org.example with a decription for the schema{ "$Version": "4.01", "org.example.": { @Org.OData.Core.V1.Description: "Example schema", … }, … }Member $AliasThe value of $Alias is a string containing an alias for the schema. Note: this alias is only for compatibility and for use in instance annotations within JSON message bodies, see [OData-JSON]. CSDL JSON documents only use namespace-qualified names to reference model constructs, they MUST NOT use alias-qualified names.Member $AnnotationsThe value of $Annotations is an object with one member per annotation target. The member name is a path identifying the annotation target, the member value is an object containing annotations for that target.Entity TypeAn entity type is represented as a member of the document object whose name is the namespace-qualified name of the entity type and whose value is an object.The value object MUST contain the member $kind with a string value of EntityType. It MAY contain the members $BaseType, $Abstract, $OpenType, $HasStream, and $Key. It also MAY contain members representing structural properties and navigation properties as well as annotations.Example 6: a simple entity type"org.example.Employee": { "$kind": "EntityType", "$Key": [ "ID" ], "ID": { "$kind": "Property", "$Type": "Edm.String", "$Nullable": false }, "FirstName": { "$kind": "Property", "$Type": "Edm.String", "$Nullable": false }, "LastName": { "$kind": "Property", "$Type": "Edm.String", "$Nullable": false }, "Manager": { "$kind": "NavigationProperty", "$Type": "org.example.Manager" }}Example 7: a derived entity type based on the previous example"org.example.Manager": { "$kind": "EntityType", "$BaseType": "org.example.Employee", "AnnualBudget": { "$kind": "Property", "$Type": "Edm.Decimal" }, "Employees": { "$kind": "NavigationProperty", "$isCollection": true, "$Type": "org.example.Employee" }}Member $BaseTypeThe value of $BaseType is the namespace-qualified name of the base type.Member $AbstractThe value of $Abstract is the JSON literal true. This member is only allowed for abstract entity types.Member $OpenTypeThe value of $OpenType is the JSON literal true. This member is only allowed for open entity types.Member $HasStreamThe value of $HasStream is the JSON literal true. This member is only allowed for media entity types.Member $KeyThe value of $Key is an array with one item per key property.Key properties without a key alias are represented as strings containing the property name.Key properties with a key alias are represented as objects with one member whose name is the key alias and whose value is a string containing the path to the property.Example 8: entity type with a simple key"org.example.Category17": { "$kind": "EntityType", "$Key": [ "ID" ], "ID": { "$kind": "Property", "$Type": "Edm.Int32", "$Nullable": false }, "Name": { "$kind": "Property", "$Type": "Edm.String", "@Org.OData.Core.V1.IsLanguageDependent": true }}Example SEQ Example \* ARABIC 9: entity type with a simple key referencing a property of a complex type"org.example.Category": { "$kind": "EntityType", "$Key": [ { "EntityInfoID": "Info/ID" } ], "Info": { "$kind": "Property", "$Type": "org.example.EntityInfo", "$Nullable": false }, "Name": { "$kind": "Property", "$Type": "Edm.String" }},"org.example.EntityInfo": { "$kind": "ComplexType", "ID": { "$kind": "Property", "$Type": "Edm.Int32", "$Nullable": false }, "Created": { "$kind": "Property", "$Type": "Edm.DateTimeOffset" }}Example 10: entity type with a composite key"org.example.OrderLine": { "$kind": "EntityType", "$Key": [ "OrderID", "LineNumber" ], "OrderID": { "$kind": "Property", "$Type": "Edm.Int32", "$Nullable": false }, "LineNumber": { "$kind": "Property", "$Type": "Edm.Int32", "$Nullable": false }}Example 11 (based on example REF ExampleNumberentityref \h 9): requests to an entity set Categories of type Category must use the alias(EntityInfoID=1)Example 12 (based on example REF ExampleNumberentityref \h 9): in a query part the value assigned to the name attribute must be used?$filter=Info/ID le 100Structural PropertyStructural properties are represented as members of the object representing a structured type. The member name is the property name, the member value is an object.The value object MUST contain the member $kind with a string value of Property. It MUST contain the member $Type, and it MAY contain the members $isCollection, $Nullable, $MaxLength, $Precision, $Scale, $Unicode, $SRID, and $DefaultValue. It also MAY contain annotations.Example 13: complex type with two properties Dimension and Length"org.example.Measurement": { "$kind": "ComplexType", "Dimension": { "$kind": "Property", "$Type": "Edm.String", "$Nullable": false, "$MaxLength": 50, "$DefaultValue": "Unspecified" }, "Length": { "$kind": "Property", "$Type": "Edm.Decimal", "$Nullable": false, "$Precision": 18, "$Scale": 2 }}Members $Type and $isCollectionFor single-valued properties the value of $Type is the namespace-qualified name of the property’s type.For collection-valued properties the value of $Type is the namespace-qualified name of the property’s item type, and the member $isCollection MUST be present with the JSON literal value true.Example 14: property Units that can have zero or more strings as its value"Units": { "$kind": "Property", "$isCollection": true, "$Type": "Edm.String"}Member $NullableThe value of $Nullable is the JSON literal false. This member is only allowed for non-nullable properties.Member $MaxLengthThe value of $MaxLength is a JSON number. The logical value max is not represented in CSDL JSON, instead services SHOULD state the maximum supported length.Member $PrecisionThe value of $Precision is a JSON number.Member $ScaleThe value of $Scale is a JSON number or a JSON string with one of the symbolic values floating or variable.Member $UnicodeThe value of $Unicode is the JSON literal true. This member is only allowed for string properties that accept Unicode characters.Member $SRIDThe value of $SRID is a JSON number or a JSON string with containing a number or the symbolic value variable. Member $DefaultValueThe value of $DefaultValue is the type-specific JSON representation of the default value of the property, see [OData-JSON].Navigation PropertyNavigation properties are represented as members of the object representing a structured type. The member name is the property name, the member value is an object.The value object MUST contain the member $kind with a string value of NavigationProperty. It MUST contain the member $Type, and it MAY contain the members $isCollection, $Nullable, $Partner, $ContainsTarget, $ReferentialConstraint, and $OnDelete. It also MAY contain annotations. Annotations for $OnDelete are prefixed with $OnDelete.Example 15: the Product entity type has a navigation property to a Category, which has a navigation link back to one or more products"org.example.Product": { "$kind": "EntityType", "$Key": [ "ID" ], "ID": { "$kind": "Property", "$Type": "Edm.String", "$Nullable": false }, "CategoryID": { "$kind": "Property", "$Type": "Edm.String", "$Nullable": false }, "Category": { "$kind": "NavigationProperty", "$Type": "org.example.Category", "$Nullable": false, "$Partner": "Products", "$ReferentialConstraint": { "CategoryID": "ID" } }, "Supplier": { "$kind": "NavigationProperty", "$Type": "org.example.Supplier" }},"org.example.Category": { "$kind": "EntityType", "$Key": [ "ID" ], "ID": { "$kind": "Property", "$Type": "Edm.String", "$Nullable": false }, "Products": { "$kind": "NavigationProperty", "$isCollection": true, "$Type": "org.example.Product", "$Partner": "Category", "$OnDelete": "Cascade", "$OnDelete@Org.OData.Core.V1.Description": "Delete all related entities" }}Member $Type and $isCollectionFor single-valued navigation properties the value of $Type is the namespace-qualified name of the navigation property’s type.For collection-valued navigation properties the value of $Type is the namespace-qualified name of the navigation property’s item type, and the member $isCollection MUST be present with the JSON literal value true.Member $NullableThe value of $Nullable is the JSON literal false. This member is only allowed for non-nullable navigation properties.Member $PartnerThe value of $Partner is a JSON string containing the name of the partner navigation property.Member $ContainsTargetThe value of $ContainsTarget is the JSON literal true. This member is only allowed for containment navigation properties.Member $ReferentialConstraintThe value of $ReferentialConstraint is an object with one member per referential constraint. The member name is the name of the dependent property, the member value is a string containing the name of the principal property.It also MAY contain HYPERLINK \l "_Annotation" annotations. These are prefixed with the name of the dependent property of the annotated referential constraint.Member $OnDeleteThe value of $OnDelete is a string with one of the values Cascade, None, SetNull, or plex TypeA complex type is represented as a member of the document object whose name is the namespace-qualified name of the complex type and whose value is an object.The value object MUST contain the member $kind with a string value of ComplexType. It MAY contain the members $BaseType, $Abstract, and $OpenType. It also MAY contain members representing structural properties and navigation properties as well as annotations.Example 16: a complex type used by two entity types"org.example.Dimensions": { "$kind": "ComplexType", "Height": { "$kind": "Property", "$Nullable": false, "$Type": "Edm.Decimal" }, "Weight": { "$kind": "Property", "$Nullable": false, "$Type": "Edm.Decimal" }, "Length": { "$kind": "Property", "$Nullable": false, "$Type": "Edm.Decimal" }},"org.example.Product": { … "ProductDimensions": { "$kind": "Property", "$Type": "org.example.Dimensions" }, "ShippingDimensions": { "$kind": "Property", "$Type": "org.example.Dimensions" }},"org.example.ShipmentBox": { … "Dimensions": { "$kind": "Property", "$Type": "org.example.Dimensions" }}Member $BaseTypeThe value of $BaseType is the namespace-qualified name of the base type.Member $AbstractThe value of $Abstract is the JSON literal true. This member is only allowed for abstract conplex types.Member $OpenTypeThe value of $OpenType is the JSON literal true. This member is only allowed for open complex types.Enumeration TypeAn enumeration type is represented as a member of the document object whose name is the namespace-qualified name of the enumeration type and whose value is an object.The value object MUST contain the member $kind with a string value of EnumType. It MAY contain the members $UnderlyingType and $IsFlags.The value object MUST contain object members representing the enumeration members of the enumeration type, where the object member name is the enumeration member name, and the object member value is the enumeration member value. The value object MAY contain annotations. Annotations for enumeration members are prefixed with the enumeration member name.Example 17: a simple flags-enabled enumeration"org.example.FileAccess": { "$kind": "EnumType", "$UnderlyingType": "Edm.Int32", "$IsFlags": true, "Read": 1, "Write": 2, "Create": 4, "Delete": 8}Example 18: FirstClass has a value of 0, TwoDay a value of 1, and Overnight a value of 2."org.example.ShippingMethod": { "$kind": "EnumType", "FirstClass": 0, "FirstClass@Org.OData.Core.V1.Description": "Shipped with highest priority", "TwoDay": 1, "TwoDay@Org.OData.Core.V1.Description": "Shipped within two days", "Overnight": 2, "Overnight@Org.OData.Core.V1.Description": "Shipped overnight", "@Org.OData.Core.V1.Description": "Method of shipping"}Example 19: pattern values can be combined, and some combined values have explicit names"org.example.Pattern": { "$kind": "EnumType", "$UnderlyingType": "Edm.Int32", "$IsFlags": true, "Plain": 0, "Red": 1, "Blue": 2, "Yellow": 4, "Solid": 8, "Striped": 16, "SolidRed": 9, "SolidBlue": 10, "SolidYellow": 12, "RedBlueStriped": 19, "RedYellowStriped": 21, "BlueYellowStriped": 22}Member $UnderlyingTypeThe value of $UnderlyingType is the namespace-qualified name of the underlying type.Member $IsFlagsThe value of $ContainsTarget is the JSON literal true. This member is only allowed for flags enumeration types.Type DefinitionA type definition is represented as a member of the document object whose name is the namespace-qualified name of the type definition and whose value is an object.The value object MUST contain the member $kind with a string value of TypeDefinition and the member HYPERLINK \l "_Member_$UnderlyingType_1" $UnderlyingType. It MAY contain the members HYPERLINK \l "_Member_$UnderlyingType_1" $UnderlyingType, $MaxLength, HYPERLINK \l "_Member_$Unicode" $Unicode, $Precision, $Scale, $Unicode, and $SRID, and it MAY contain annotations. Example 20: "org.example.Length": { "$kind": "TypeDefinition", "$UnderlyingType": "Edm.Int32", "@Org.OData.Measures.V1.Unit": "Centimeters"},"org.example.Weight": { "$kind": "TypeDefinition", "$UnderlyingType": "Edm.Int32", "@Org.OData.Measures.V1.Unit": "Kilograms"},"org.example.Size": { "$kind": "ComplexType", "Height": { "$kind": "Property", "$Type": "org.example.Length" }, "Weight": { "$kind": "Property", "$Type": "org.example.Weight" }}Member $UnderlyingTypeThe value of $UnderlyingType is the namespace-qualified name of the underlying type.Action and FunctionAn action or function is represented as a member of the document object whose name is the namespace-qualified name of the action or function and whose value is an array. The array contains one object per action of function overload.Action OverloadThe overload object for an action MUST contain the member $kind with a string value of Action. It MAY contain the members $IsBound, $EntitySetPath, $Parameter, and $ReturnType, and it MAY contain annotations. Function OverloadThe overload object for a function MUST contain the member $kind with a string value of Function, and it MUST contain the member $ReturnType. It MAY contain the members $IsBound, $EntitySetPath, and $Parameter, and it MAY contain annotations. Example 21: a function returning the top-selling products for a given year. In this case the year must be specified as a parameter of the function with the edm:Parameter element."org.SellingProducts": [ { "$kind": "Function", "$Parameter": [ { "$Name": "Year", "$Type": "Edm.Decimal", "$Precision": 4, "$Scale": 0 } ], "$ReturnType": { "$isCollection": true, "$Type": "org.example.Product" } }]Member $IsBoundThe value of $IsBound is the JSON literal true. This member is only allowed for bound action and function overloads.Member $IsComposableThe value of $IsComposable is the JSON literal true. This member is only allowed for composable function overloads.Member $EntitySetPathThe value of $EntitySetPath is a string containing the entity set path.Member $ReturnTypeThe value of $ReturnType is an object. It MUST contain the member $Type, and it MAY contain the members $isCollection, $Nullable, $MaxLength, HYPERLINK \l "_Member_$Unicode" $Unicode, $Precision, $Scale, and $SRID. It also MAY contain annotations.Members $Type and $isCollectionFor single-valued return types the value of $Type is the namespace-qualified name of the returned type.For collection-valued return types the value of $Type is the namespace-qualified name of the returned item type, and the member $isCollection MUST be present with the JSON literal value true.Member $NullableThe value of $Nullable is the JSON literal false. This member is only allowed for non-nullable return types. Member $ParameterThe value of $Parameter is an array. The array contains one object per parameter.A parameter object It MUST contain the members $Name and $Type, and it MAY contain the members $isCollection, $Nullable, $MaxLength, HYPERLINK \l "_Member_$Unicode" $Unicode, $Precision, $Scale, and $SRID. Parameter objects MAY also contain annotations.Member $NameThe value of $Name is a string containing the parameter name.Members $Type and $isCollectionFor single-valued parameters the value of $Type is the namespace-qualified name of the accepted type.For collection-valued parameters the value of $Type is the namespace-qualified name of the accepted item type, and the member $isCollection MUST be present with the JSON literal value true.Member $NullableThe value of $Nullable is the JSON literal false. This member is only allowed for non-nullable parameters.Entity ContainerAn entity container is represented as two members of the document object, once as a member $EntityContainer whose value is a string with the namespace-qualified name of the entity container, and once as a member whose name is the namespace-qualified name of the entity container and whose value is an object.The value object MAY contain the member $Extends, members representing entity sets, singletons, action imports, and function imports, as well as annotations.Example 22: An entity container aggregates entity sets, singletons, action imports, and function imports."$EntityContainer": "org.example.DemoService","org.example.DemoService": { "$kind": "EntityContainer", "Products": { "$kind": "EntitySet", "$Type": "org.example.Product", "$NavigationPropertyBinding": { "Category": "Categories", "Supplier": "Suppliers" }, "@org.example.display.DisplayName": "Product Catalog" }, "Categories": { "$kind": "EntitySet", "$Type": "org.example.Category", "$NavigationPropertyBinding": { "Products": "Products" } }, "Suppliers": { "$kind": "EntitySet", "$Type": "org.example.Supplier", "$NavigationPropertyBinding": { "Products": "Self.DemoService" }, "@org.example.display.DisplayName": "Supplier Directory" }, "MainSupplier": { "$kind": "Singleton", "$Type": "org.example.Supplier" }, "LeaveRequestApproval": { "$kind": "ActionImport", "$Action": "org.example.Approval" }, "ProductsByRating": { "$kind": "FunctionImport", "$EntitySet": "Products", "$Function": "ODataDemo.ProductsByRating" }}Member $ExtendsThe value of $Extends is the namespace-qualified name of the entity container to be extended.Entity SetAn entity set is represented as a member of the entity container object whose name is the name of the entity set and whose value is an object.The value object MUST contain the member $kind with a string value of EntitySet, and the member $Type whose string value is the namespace-qualified name of an entity type.It MAY contain the members $IncludeInServiceDocument and $NavigationPropertyBinding as well as annotations.Member $IncludeInServiceDocumentThe value of $IncludeInServiceDocument is the JSON literal false. This member is only allowed for entity sets not advertised in the service document.Member $NavigationPropertyBindingThe value of $NavigationPropertyBinding is an object. It consists of members whose name is the navigation property binding path and whose value is a string containing the navigation property binding target. If the target is in the same entity container, the target MUST NOT be prefixed with the qualified entity container name.Example 23: for an entity set in the same container as the enclosing entity set Categories"Categories": { "$kind": "EntitySet", "$Type": "org.example.Category", "$NavigationPropertyBinding": { "Products": "SomeSet" }}Example 24: for an entity set in any container in scope"Categories": { "$kind": "EntitySet", "$Type": "org.example.Category", "$NavigationPropertyBinding": { "Products": "SomeModel.SomeContainer/SomeSet" }}SingletonA singleton is represented as a member of the entity container object whose name is the name of the singleton and whose value is an object.The value object MUST contain the member $kind with a string value of Singleton, and the member $Type whose string value is the namespace-qualified name of an entity type.It MAY contain the member $NavigationPropertyBinding as well as annotations.Action ImportAn action import is represented as a member of the entity container object whose name is the name of the action import and whose value is an object.The value object MUST contain the member $kind with a string value of ActionImport, and the member $Action whose string value is the namespace-qualified name of an unbound action.It MAY contain the member $EntitySet whose string value is either the unqualified name of an entity set in the same entity container or a path to an entity set in a different entity container.It MAY also contain annotations.Function ImportA function import is represented as a member of the entity container object whose name is the name of the function import and whose value is an object.The value object MUST contain the member $kind with a string value of FunctionImport, and the member $Function whose string value is the namespace-qualified name of an unbound function.It MAY contain the member $EntitySet whose string value is either the unqualified name of an entity set in the same entity container or a path to an entity set in a different entity container.It MAY also contain the member $IncludeInServiceDocument as well as annotations.Member $IncludeInServiceDocumentThe value of $IncludeInServiceDocument is the JSON literal true. This member is only allowed for function imports advertised in the service document.Vocabulary and AnnotationTermA term is represented as a member of the document object whose name is the namespace-qualified name of the term and whose value is an object.The value object MUST contain the member $kind with a string value of Term. It MUST contain the member $Type, and it MAY contain the members $isCollection, $AppliesTo, $Nullable, $MaxLength, $Precision, $Scale, $SRID, and $DefaultValue, and it MAY contain annotations. Note: the $DefaultValue member is purely for documentation. Annotations in CSDL JSON documents MUST always specify a value.Member $Type and $isCollectionFor single-valued terms the value of $Type is the namespace-qualified name of the term’s type.For collection-valued terms the value of $Type is the namespace-qualified name of the term’s item type, and the member $isCollection MUST be present with the JSON literal value true.Member $NullableThe value of $Nullable is the JSON literal false. This member is only allowed for non-nullable terms.Member $AppliesToThe value of $AppliesTo is an array whose items are strings containing model element names the term can be applied to.Example 25: the IsURL term can be applied to properties and terms that are of type Edm.String"org.example2.IsURL": { "$kind": "Term", "$Type": "Org.OData.Core.V1.Tag", "$DefaultValue": true, "$AppliesTo": [ "Property" ], "@Org.OData.Core.V1.Description": "Properties and terms annotated with this term MUST contain a valid URL", "@Org.OData.Core.V1.RequiresType": "Edm.String"}AnnotationAn annotation is represented as a member whose name consists of an at (@) character, followed by the namespace-qualified name of a term, optionally followed by a hash (#) and a qualifier. The value is one of the representations specified in the remaining sections of this chapter.Example 26: annotation should only be applied to tablet devices"@org.example.display.DisplayName#Tablet": { "$Path": "FirstName"}Constant ExpressionsBinaryBinary expressions are represented as an object with a single member $Binary whose value is a string containing the base64url-encoded binary value.Example 27: base64url-encoded binary value (OData)"@org.example.display.Thumbnail": { "$Binary": "T0RhdGE"}BooleanBoolean expressions are represented as the JSON literals true and false.Example 28:"@org.example.display.ReadOnly": trueDateDate expressions are represented as an object with a single member $Date whose value is a string containing the date value.Example 29:"@org.example.vCard.birthDay": { "$Date": "2000-01-01"}DateTimeOffsetDatetimestamp expressions are represented as an object with a single member $DateTimeOffset whose value is a string containing the timestamp value.Example 30:"@org.example.display.LastUpdated": { "$DateTimeOffset": "2000-01-01T16:00:00.000Z"}DecimalDecimal expressions are represented as an object with a single member $Decimal whose value is a string containing the decimal value.Example 31:"@org.example.display.Width": { "$Decimal": "3.14"}DurationDuration expressions are represented as an object with a single member $Duration whose value is a string containing the duration value.Example 32:"@org.example.task.duration": { "$Duration": "P7D"}Enumeration MemberEnumeration member expressions are represented as an object with a single member $EnumMember whose value is a number or string. containing the numeric member value. Numbers are used for safe integers integer enumeration values (less than or equal to 9007199254740991), strings are used for unsafe integers and symbolic enumeration values.Example 33: single value Red with numeric value 1"@org.example.HasPattern": { "$EnumMember": 1}Example SEQ Example \* ARABIC 34: single value Red with symbolic value"@org.example.HasPattern": { "$EnumMember": "Red"}Example 35: combined value Red,Striped with numeric value 1 + 16"@org.example.HasPattern": { "$EnumMember": 17}Example SEQ Example \* ARABIC 36: combined value Red,Striped with symbolic value6"@org.example.HasPattern": { "$EnumMember": "Red,Striped"} Floating-Point NumberFloating-point expressions are represented as a number or as an object with a single member $Float whose value is a string containing one of the special values INF, -INF, or NaN.Example 37:"@org.example.display.FloatWidth": 3.14, "@org.example.display.FloatWidth": "INF", // 4.0 style"@org.example.display.FloatWidth": null, // 4.01 style"@org.example.display.FloatWidth@Org.OData.Core.NumericValueException": "INF", "@org.example.display.FloatWidth#INF": { // OpenUI5 style "$Float": "INF"}GuidGuid expressions are represented as an object with a single member $Guid whose value is a string containing the guid value.Example 38:"@org.example.display.Id": { "$Guid": "21EC2020-3AEA-1069-A2DD-08002B30309D"}IntegerInteger expressions are represented as a number or as an object with a single member $Int whose value is a string containing the integer value. Numbers are used for safe integers (less than or equal to 9007199254740991), strings are used for unsafe integers.Example 39:"@An.Int": 1234,"@A.Very.Long.Int": "9007199254740992""@A.Very.Long.Int": { "$Int": "9007199254740992"}StringString expressions are represented as a string.Example 40:"@org.example.display.DisplayName": "Product Catalog"Time of DayTime-of-day expressions are represented as an object with a single member $TimeOfDay whose value is a string containing the time-of-day value.Dynamic ExpressionsComparison and Logical OperatorsNegation expressions are represented as an object with a single member $Not whose value is a constant or dynamic annotation expression.All other comparison and logical expressions are represented as an object with a single member whose value is an array with two annotation expressions. The member name is one of $And, $Or, $Eq, $Ne, $Gt, $Ge, $Lt, or $Le.Example 41:{ "$And": [ { "$Path": "IsMale" }, { "$Path": "IsMarried" } ]},{ "$Or": [ { "$Path": "IsMale" }, { "$Path": "IsMarried" } ]},{ "$Not": { "$Path": "IsMale" }},{ "$Eq": [ null, { "$Path": "IsMale" } ]},{ "$Ne": [ null, { "$Path": "IsMale" } ]},{ "$Gt": [ { "$Path": "Price" }, 20 ]},{ "$Ge": [ { "$Path": "Price" }, 10 ]},{ "$Lt": [ { "$Path": "Price" }, 20 ]},{ "$Le": [ { "$Path": "Price" }, 100 ]} Annotation Path ExpressionAnnotation path expressions are represented as an object with a single member $AnnotationPath whose value is a string containing a path.Example 42:"@org.example.DisplayUI.ReferenceFacet": { "$AnnotationPath": "Product/Supplier/@UIorg.example.Display.LineItem"},"@UIorg.example.Display.CollectionFacet#Contacts": [ { "$AnnotationPath": "Supplier/@Communication.Contact" }, { "$AnnotationPath": "Customer/@Communication.Contact" }]Apply Expression and Client-Side FunctionsApply expressions are represented as an object with a member $Apply whose value is an array of annotation expressions, and a member $Function whose value is a string containing the name of the client-side function to be applied.Function odata.concatThe function odata.concat takes two or more expressions as arguments and returns a string value. Example 43:"@org.example.display.DisplayName": { "$Apply": [ "Product: ", { "$Path": "ProductName" }, " (", { "$Path": "Available/Quantity" }, " ", { "$Path": "Available/Unit" }, " available)" ], "$Function": "odata.concat"}ProductName is of type String, Quantity in complex type Available is of type Decimal, and Unit in Available is of type enumeration, so the result of the Path expression is represented as the member name of the enumeration value.Function odata.fillUriTemplateThe function odata.fillUriTemplate takes two or more expressions as arguments and returns a string value. Example 44: assuming there are no special characters in values of the Name property of the Actor entity{ "$Apply": [ "{actorName}/CV", { "$LabeledElement": { "$Path": "Actor/Name" }, "$Name": "org.example.actorName" } ], "$Function": "odata.fillUriTemplate"}Function odata.uriEncodeThe function odata.uriEncode takes one expressions as its arguments and returns a string value. Example 45:{ "$Apply": [ "({genreName})", { "$LabeledElement": { "$Apply": [ { "$Path": "NameOfMovieGenre" } ], "$Function": "odata.uriEncode" }, "$Name": "org.example.genreName" } ], "$Function": "odata.fillUriTemplate"}Cast ExpressionCast expressions are represented as an object with a member $Cast whose value is an annotation expressions, and a member $Type whose value is a string containing the namespace-qualified type name.Example 46:"@org.example.display.Threshold": { "$Cast": { "$Path": "Average" }, "$Type": "Edm.Decimal"}Collection ExpressionCollection expressions are represented as arrays with one item per expression within the collection.Example 47:"@org.example.seo.SeoTerms": [ "Product", "Supplier", "Customer"]If ExpressionIf expressions are represented as an object with a member $If whose value is an array of two or three annotation expressions. The first expression is the conditional expression, the second optional third expression are evaluated conditionally.Example 48:"@org.example.person.Gender": { "$If": [ { "$Path": "IsFemale" }, "Female", "Male" ]}Is-Of ExpressionIs-of expressions are represented as an object with a member $IsOf whose value is an annotation expressions, and a member $Type whose value is a string containing a namespace-qualified type name.Example 49:"@Self.IsPreferredCustomer": { "$IsOf": { "$Path": "Customer" }, "$Type": "org.example.PreferredCustomer"}Labeled Element ExpressionLabeled element expressions are represented as an object with a member $LabeledElement whose value is an annotation expressions, and a member $Name whose value is a string containing a namespace-qualified name. The namespace MUST be identical to the namespace of the schema containing the labeled element expression. Example 50:"@org.example.display.DisplayName": { "$LabeledElement": { "$Path": "FirstName" }, "$Name": "org.example.CustomerFirstName"}Labeled Element Reference ExpressionLabeled element reference expressions are represented as an object with a member $LabeledElementReference whose value is a string containing a namespace-qualified name.Example 51:"@org.example.display.DisplayName": { "$LabeledElementReference": "org.example.CustomerFirstName"}Null ExpressionNull expressions that do not contain annotations are represented as the JSON literal null. Example 52:"@org.example.display.DisplayName": null,Null expression containing annotations are represented as an object with a member $Null whose value is the JSON literal null.Example 53:"@org.example.display.Address": null,"@org.example.display.Address@org.example.Reason": "Private""@org.example.display.Address": { "$Null": null, "@org.example.Reason": "Private"}Navigation Property Path ExpressionNavigation property path expressions are represented as an object with a single member $NavigationPropertyPath whose value is a string containing a path.Example 54:"@org.example.DisplayUI.HyperLink": { "$NavigationPropertyPath": "Supplier"},"@Capabilities.UpdateRestrictions": { "NonUpdatableNavigationProperties": [ { "$NavigationPropertyPath": "Supplier" }, { "$NavigationPropertyPath": "Category" } ]}Path ExpressionPath expressions are represented as an object with a single member $Path whose value is a string containing a path.Example 55:"@org.example.display.DisplayName": { "$Path": "FirstName"},"@org.example.display.DisplayName#second": { "$Path": "@vCard.Address#work/FullName"}Property Path ExpressionProperty path expressions are represented as an object with a single member $PropertyPath whose value is a string containing a path.Example 56:"@org.example.DisplayUI.RefreshOnChangeOf": { "$PropertyPath": "ChangedAt"},"@Capabilities.UpdateRestrictions": { "NonUpdatableProperties": [ { "$PropertyPath": "CreatedAt" }, { "$PropertyPath": "ChangedAt" } ]}Record ExpressionRecord expressions are represented as objects with one member per property. The member name is the property name, the member value is the property value.Example 57: record with two structural and two navigation properties"@org.example.person.Employee": { "GivenName": { "$Path": "FirstName" }, "Surname": { "$Path": "LastName" }, "Manager": { "$Path": "DirectSupervisor" }, "CostCenter": { "$UrlRef": { "$Apply": [ "('{ccid}')", { "$LabeledElement": { "$Path": "CostCenterID" }, "$Name": "org.id" } ], "$Function": "odata.fillUriTemplate" } }}URL Reference ExpressionURL reference expressions are represented as an object with a single member $UrlRef whose value is an annotation expression.Example 58:"@Vocab.Supplier": { "$UrlRef": { "$Apply": [ "({suppID})", { "$LabeledElement": { "$Apply": [ { "$Path": "SupplierId" } ], "$Function": "odata.uriEncode" }, "$Name": "org.example.suppID" } ], "$Function": "odata.fillUriTemplate" }},"@Org.OData.Core.V1.LongDescription#element": { "$UrlRef": ""}CSDL Examples Following are two basic examples of valid EDM models as represented in CSDL JSON. These examples demonstrate many of the topics covered above.Products and Categories Example Example 59:{ "$Version": "4.01", "$EntityContainer": "ODataDemo.DemoService", "$Reference": { "": { "$Include": [ { "Org.OData.Core.V1.": "Core", "@Org.OData.Core.V1.DefaultNamespace": true } ] }, "": { "$Include": [ "Org.OData.Measures.V1." ] } }, "ODataDemo.": { "$kind": "Schema", "@Org.OData.Core.V1.DefaultNamespace": true }, "ODataDemo.Product": { "$kind": "EntityType", "$HasStream": true, "$Key": [ "ID" ], "ID": { "$kind": "Property", "$Type": "Edm.String", "$Nullable": false }, "Description": { "$kind": "Property", "$Type": "Edm.String", "@Org.OData.Core.V1.IsLanguageDependent": true }, "ReleaseDate": { "$kind": "Property", "$Type": "Edm.Date" }, "DiscontinuedDate": { "$kind": "Property", "$Type": "Edm.Date" }, "Rating": { "$kind": "Property", "$Type": "Edm.Int32" }, "Price": { "$kind": "Property", "$Type": "Edm.Decimal", "@Org.OData.Measures.V1.ISOCurrency": { "$Path": "Currency" } }, "Currency": { "$kind": "Property", "$Type": "Edm.String", "$MaxLength": 3 }, "Category": { "$kind": "NavigationProperty", "$Type": "ODataDemo.Category", "$Nullable": false, "$Partner": "Products" }, "Supplier": { "$kind": "NavigationProperty", "$Type": "ODataDemo.Supplier", "$Partner": "Products" } }, "ODataDemo.Category": { "$kind": "EntityType", "$Key": [ "ID" ], "ID": { "$kind": "Property", "$Type": "Edm.Int32", "$Nullable": false }, "Name": { "$kind": "Property", "$Type": "Edm.String", "$Nullable": false, "@Org.OData.Core.V1.IsLanguageDependent": true }, "Products": { "$kind": "NavigationProperty", "$Partner": "Category", "$isCollection": true, "$Type": "ODataDemo.Product", "$OnDelete": "Cascade" } }, "ODataDemo.Supplier": { "$kind": "EntityType", "$Key": [ "ID" ], "ID": { "$kind": "Property", "$Type": "Edm.String", "$Nullable": false }, "Name": { "$kind": "Property", "$Type": "Edm.String" }, "Address": { "$kind": "Property", "$Type": "ODataDemo.Address", "$Nullable": false }, "Concurrency": { "$kind": "Property", "$Type": "Edm.Int32", "$Nullable": false }, "Products": { "$kind": "NavigationProperty", "$Partner": "Supplier", "$isCollection": true, "$Type": "ODataDemo.Product" } }, "ODataDemo.Country": { "$kind": "EntityType", "$Key": [ "Code" ], "Code": { "$kind": "Property", "$Type": "Edm.String", "$MaxLength": 2, "$Nullable": false }, "Name": { "$kind": "Property", "$Type": "Edm.String" } }, "ODataDemo.Address": { "$kind": "ComplexType", "Street": { "$kind": "Property", "$Type": "Edm.String" }, "City": { "$kind": "Property", "$Type": "Edm.String" }, "State": { "$kind": "Property", "$Type": "Edm.String" }, "ZipCode": { "$kind": "Property", "$Type": "Edm.String" }, "CountryName": { "$kind": "Property", "$Type": "Edm.String" }, "Country": { "$kind": "NavigationProperty", "$Type": "ODataDemo.Country", "$ReferentialConstraint": { "CountryName": "Name" } } }, "ODataDemo.ProductsByRating": [ { "$kind": "Function", "$Parameter": [ { "$Name": "Rating", "$Type": "Edm.Int32" } ], "$ReturnType": { "$isCollection": true, "$Type": "ODataDemo.Product" } } ], "ODataDemo.DemoService": { "$kind": "EntityContainer", "Products": { "$kind": "EntitySet", "$Type": "ODataDemo.Product", "$NavigationPropertyBinding": { "Category": "Categories" } }, "Categories": { "$kind": "EntitySet", "$Type": "ODataDemo.Category", "$NavigationPropertyBinding": { "Products": "Products" }, "@Org.OData.Core.V1.Description": "Product Categories" }, "Suppliers": { "$kind": "EntitySet", "$Type": "ODataDemo.Supplier", "$NavigationPropertyBinding": { "Products": "Products", "Address/Country": "Countries" }, "@Org.OData.Core.V1.OptimisticConcurrency": [ { "$PropertyPath": "Concurrency" } ] }, "Countries": { "$kind": "EntitySet", "$Type": "ODataDemo.Country" }, "MainSupplier": { "$kind": "Singleton", "$Type": "ODataDemo.Supplier", "$NavigationPropertyBinding": { "Products": "Products" }, "@Org.OData.Core.V1.Description": "Primary Supplier" }, "ProductsByRating": { "$kind": "FunctionImport", "$EntitySet": "Products", "$Function": "ODataDemo.ProductsByRating" } }}Annotations for Products and Categories Example Example 60:{ "$Version": "4.01", "$Reference": { "$metadata": { "$Include": [ "ODataDemo." ] }, "": { "$Include": [ { "Some.Vocabulary.V1.": "Vocabulary1" } ] } }, "External.Annotations.": { "$kind": "Schema", "$Annotations": { "ODataDemo.Supplier": { "@Some.Vocabulary.V1.EMail": null, "@Some.Vocabulary.V1.AccountID": { "$Path": "ID" }, "@Some.Vocabulary.V1.Title": "Supplier Info", "@Some.Vocabulary.V1.DisplayName": { "$Apply": [ { "$Path": "Name" }, " in ", { "$Path": "Address/CountryName" } ], "$Function": "odata.concat" } }, "ODataDemo.Product": { "@Some.Vocabulary.V1.Tags": [ "MasterData" ] } } }} ConformanceConforming services MUST follow all rules of this specification document for the types, sets, functions, actions, containers and annotations they expose. In addition, conforming services MUST NOT return 4.01 model CSDL constructs for requests made with OData-MaxVersion:4.0.Specifically, theyMUST NOT include properties in derived types that overwrite a property defined in the base typeMUST NOT include Edm.Untyped MUST NOT include extended Edm.PathEdm.Path expression MUST NOT use EdmDM.AnyPath and Edm.AnyPropertyPath MUST NOT specify referential constraints HYPERLINK \l "_7_Complex_Type" _7_Complex_Type to complex types and navigation properties MUST NOT include a non-abstract entity type with no inherited or defined entity key SHOULD NOT include new/unknown values for $AppliesToMAY include new CSDL annotationsConforming clients MUST be prepared to consume a model that uses any or all of the constructs defined in this specification, including custom annotations, and MUST ignore any elements or attributes not defined in this version of the specification.AcknowledgmentsThe work of the OpenUI5 team on the OData V4 Metadata JSON Format, see [ HYPERLINK \l "OpenUI5" OpenUI5], is gratefully acknowledged, especially the contributions of Thomas Chadzelek (SAP SE)Jens Ittel (SAP SE)Patric Ksinsik (SAP SE)The contributions of the OASIS OData Technical Committee members, enumerated in [ODataProtocol], are gratefully acknowledged. Revision HistoryRevisionDateEditorChanges MadeWorking Draft 012016-11-16Ralf HandlInitial version ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download