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



OData Common Schema Definition Language (CSDL) JSON Representation Version 4.01 Working Draft 0115 20 February 2017Technical 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.01 (this document)JSON schemas; OData CSDL JSON schema. . Related 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 _Toc475362505 \h 61.1 Terminology PAGEREF _Toc475362506 \h 61.2 Normative References PAGEREF _Toc475362507 \h 61.3 Non-Normative References PAGEREF _Toc475362508 \h 61.4 Typographical Conventions PAGEREF _Toc475362509 \h 62Design Considerations PAGEREF _Toc475362510 \h 72.1 Construction Principles PAGEREF _Toc475362511 \h 72.2 JSON Schema Definition PAGEREF _Toc475362512 \h 73CSDL JSON Document PAGEREF _Toc475362513 \h 83.1 Member $Reference PAGEREF _Toc475362514 \h 83.2 Member $Include PAGEREF _Toc475362515 \h 83.3 Member $IncludeAnnotations PAGEREF _Toc475362516 \h 93.4 Member $EntityContainer PAGEREF _Toc475362517 \h 94Schema PAGEREF _Toc475362518 \h 104.1 Member $Alias PAGEREF _Toc475362519 \h 104.2 Member $Annotations PAGEREF _Toc475362520 \h 105Entity Type PAGEREF _Toc475362521 \h 115.1 Member $Key PAGEREF _Toc475362522 \h 115.2 Member $BaseType PAGEREF _Toc475362523 \h 135.3 Member $Abstract PAGEREF _Toc475362524 \h 135.4 Member $OpenType PAGEREF _Toc475362525 \h 135.5 Member $HasStream PAGEREF _Toc475362526 \h 136Structural Property PAGEREF _Toc475362527 \h 146.1 Members $Type and $IsCollection PAGEREF _Toc475362528 \h 146.2 Member $Nullable PAGEREF _Toc475362529 \h 146.3 Member $MaxLength PAGEREF _Toc475362530 \h 146.4 Member $Precision PAGEREF _Toc475362531 \h 146.5 Member $Scale PAGEREF _Toc475362532 \h 156.6 Member $Unicode PAGEREF _Toc475362533 \h 156.7 Member $SRID PAGEREF _Toc475362534 \h 156.8 Member $DefaultValue PAGEREF _Toc475362535 \h 157Navigation Property PAGEREF _Toc475362536 \h 167.1 Member $Type and $IsCollection PAGEREF _Toc475362537 \h 167.2 Member $Nullable PAGEREF _Toc475362538 \h 177.3 Member $Partner PAGEREF _Toc475362539 \h 177.4 Member $ContainsTarget PAGEREF _Toc475362540 \h 177.5 Member $ReferentialConstraint PAGEREF _Toc475362541 \h 177.6 Member $OnDelete PAGEREF _Toc475362542 \h 178Complex Type PAGEREF _Toc475362543 \h 189Enumeration Type PAGEREF _Toc475362544 \h 199.1 Member $UnderlyingType PAGEREF _Toc475362545 \h 209.2 Member $IsFlags PAGEREF _Toc475362546 \h 2010Type Definition PAGEREF _Toc475362547 \h 2110.1 Member $UnderlyingType PAGEREF _Toc475362548 \h 2111Action and Function PAGEREF _Toc475362549 \h 2211.1 Action Overload PAGEREF _Toc475362550 \h 2211.2 Function Overload PAGEREF _Toc475362551 \h 2211.3 Member $IsBound PAGEREF _Toc475362552 \h 2211.4 Member $EntitySetPath PAGEREF _Toc475362553 \h 2211.5 Member $IsComposable PAGEREF _Toc475362554 \h 2211.6 Member $ReturnType PAGEREF _Toc475362555 \h 2311.6.1 Members $Type and $IsCollection PAGEREF _Toc475362556 \h 2311.7 Member $Parameter PAGEREF _Toc475362557 \h 2311.7.1 Member $Name PAGEREF _Toc475362558 \h 2311.7.2 Members $Type and $IsCollection PAGEREF _Toc475362559 \h 2312Entity Container PAGEREF _Toc475362560 \h 2412.1 Member $Extends PAGEREF _Toc475362561 \h 2412.2 Entity Set PAGEREF _Toc475362562 \h 2412.2.1 Member $IncludeInServiceDocument PAGEREF _Toc475362563 \h 2512.2.2 Member $NavigationPropertyBinding PAGEREF _Toc475362564 \h 2512.3 Singleton PAGEREF _Toc475362565 \h 2512.4 Action Import PAGEREF _Toc475362566 \h 2512.5 Function Import PAGEREF _Toc475362567 \h 2612.5.1 Member $IncludeInServiceDocument PAGEREF _Toc475362568 \h 2613Vocabulary and Annotation PAGEREF _Toc475362569 \h 2713.1 Term PAGEREF _Toc475362570 \h 2713.1.1 Member $Type and $IsCollection PAGEREF _Toc475362571 \h 2713.1.2 Member $BaseTerm PAGEREF _Toc475362572 \h 2713.1.3 Member $AppliesTo PAGEREF _Toc475362573 \h 2713.2 Annotation PAGEREF _Toc475362574 \h 2713.3 Constant Expressions PAGEREF _Toc475362575 \h 2813.3.1 Binary PAGEREF _Toc475362576 \h 2813.3.2 Boolean PAGEREF _Toc475362577 \h 2813.3.3 Date PAGEREF _Toc475362578 \h 2813.3.4 DateTimeOffset PAGEREF _Toc475362579 \h 2813.3.5 Decimal PAGEREF _Toc475362580 \h 2813.3.6 Duration PAGEREF _Toc475362581 \h 2813.3.7 Enumeration Member PAGEREF _Toc475362582 \h 2913.3.8 Floating-Point Number PAGEREF _Toc475362583 \h 2913.3.9 Guid PAGEREF _Toc475362584 \h 2913.3.10 Integer PAGEREF _Toc475362585 \h 2913.3.11 String PAGEREF _Toc475362586 \h 3013.3.12 Time of Day PAGEREF _Toc475362587 \h 3013.4 Dynamic Expressions PAGEREF _Toc475362588 \h 3013.4.1 Comparison and Logical Operators PAGEREF _Toc475362589 \h 3013.4.2 Annotation Path Expression PAGEREF _Toc475362590 \h 3113.4.3 Apply Expression and Client-Side Functions PAGEREF _Toc475362591 \h 3213.4.3.1 Function odata.concat PAGEREF _Toc475362592 \h 3213.4.3.2 Function odata.fillUriTemplate PAGEREF _Toc475362593 \h 3213.4.3.3 Function odata.uriEncode PAGEREF _Toc475362594 \h 3313.4.4 Cast Expression PAGEREF _Toc475362595 \h 3313.4.5 Collection Expression PAGEREF _Toc475362596 \h 3313.4.6 If Expression PAGEREF _Toc475362597 \h 3313.4.7 Is-Of Expression PAGEREF _Toc475362598 \h 3413.4.8 Labeled Element Expression PAGEREF _Toc475362599 \h 3413.4.9 Labeled Element Reference Expression PAGEREF _Toc475362600 \h 3413.4.10 Null Expression PAGEREF _Toc475362601 \h 3413.4.11 Navigation Property Path Expression PAGEREF _Toc475362602 \h 3513.4.12 Path Expression PAGEREF _Toc475362603 \h 3513.4.13 Property Path Expression PAGEREF _Toc475362604 \h 3513.4.14 Record Expression PAGEREF _Toc475362605 \h 3613.4.15 URL Reference Expression PAGEREF _Toc475362606 \h 3614CSDL Examples PAGEREF _Toc475362607 \h 3714.1 Products and Categories Example PAGEREF _Toc475362608 \h 3714.2 Annotations for Products and Categories Example PAGEREF _Toc475362609 \h 4015Conformance PAGEREF _Toc475362610 \h 42Appendix A. Acknowledgments PAGEREF _Toc475362611 \h 43Appendix B. Revision History PAGEREF _Toc475362612 \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?[RFC7159]This format is based on the OpenUI5 OData V4 Metadata JSON Format, see [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 [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. See 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. .[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 [RFC7159]. It additionally follows the rules for “Internet JSON” (I-JSON) defined in [RFC7493] for e.g. objects, numbers, date values, and duration values.It is an alternative to the CSDL XML representation defined in [ HYPERLINK \l "CSDLxml" CSDL-XML] and neither adds nor removes features.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 direct top-level members of their schemaa CSDL JSON document, using the schema-unique 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, using their locally unique name as the member name.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 all other type referencesthe corresponding attribute of the Singleton element).Additional fixed members introduced by this specification and without counterpart in [CSDL-XML] are also prefixed with a dollar ($) sign and use upperlower-camel-case names. One of these is $kind$Kind which represents the kind of model element. Its value is the upper-camel-case local name of the XML element 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 requires an alias and solely relies on namespacealias-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 HYPERLINK \l "_Member_$EntityContainer" $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 objects that MUST contain the member $Namespace whose value is a string containing the namespace of the included schema followed by a dot (.).The item objects MAY MUST contain the member $Alias whose value is a string containing the alias for the included namespace. 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-qualifiedalias-qualified names to reference model constructs, they MUST NOT use alias-qualified names.The item objects MAY contain annotations.Example 3: references to entity models containing definitions of vocabulary terms{ "$Reference": { "": { "$Include": [ { "$Namespace": "Org.OData.Capabilities.V1.", "$Alias": "Capabilities" } ] }, "": { "$Include": [ { "$Namespace": "Org.OData.Core.V1", "$Alias": "Core" } ] }, "": { "$Include": [ { "$Namespace": "org.example.dDisplay.", "$Alias": "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." } ] } }, …}Member $EntityContainerThe value of $EntityContainer is value is the namespace-qualified name of the entity container of that service. This is the only place where a model element MUST be reference with its namespace-qualified name instead of its alias-qualified name.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 MUST contain a member HYPERLINK \l "_Member_$Alias" $Alias and MAY contain a member $Annotations.The schema object MAY contain members representing HYPERLINK \l "_Entity_Type" entity types, HYPERLINK \l "_Complex_Type" complex types, HYPERLINK \l "_Enumeration_Type" enumeration types, HYPERLINK \l "_Type_Definition" type definitions, HYPERLINK \l "_Action_and_Function" actions, HYPERLINK \l "_Action_and_Function" functions, HYPERLINK \l "_Term" terms, and an HYPERLINK \l "_Entity_Container" entity container. The value schema object MAY also contain annotations that apply to the schema itself.Example 5: document defining a schema org.example with an alias and a decriptiondescription for the schema{ "$Version": "4.01", "org.example.": { "$Alias": "sSelf", "@Org.OData.Core.V1.Description": "Example schema", … }, … }Member $AliasThe value of $Alias is a string containing an alias for the schema. Note: CSDL JSON documents only use alias-qualified names to reference model constructs, they MUST NOT use namespace-qualified names except within the HYPERLINK \l "_CSDL_JSON_Document" $EntityContainer member. CSDL XML documents and JSON message bodies allow both the namespace and the aliasthis alias is only for compatibility and for use in instance annotations within JSON message bodies, see [ HYPERLINK \l "CSDLxml" CSDL-XML] and [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.Example SEQ Example \* ARABIC 6: annotations targeting the Person type with qualifier Tablet "org.example.": { "$Annotations": { "org.example.Person#Tablet": { … } } },Entity TypeAn entity type is represented as a member of the document schema object whose name is the namespace-qualifiedunqualified name of the entity type and whose value is an object.The value object MUST contain the member $kind$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 7: a simple entity type"org.example.Employee": { "$kind$Kind": "EntityType", "$Key": [ "ID" ], "ID": { "$Nullable": false }, "FirstName": { "$Nullable": false }, "LastName": { "$Nullable": false }, "Manager": { "$kind$Kind": "NavigationProperty", "$Type": "org.exampleself.Manager" }}Example 8: a derived entity type based on the previous example"org.example.Manager": { "$kind$Kind": "EntityType", "$BaseType": "org.exampleself.Employee", "AnnualBudget": { "$Type": "Edm.Decimal" }, "Employees": { "$kind$Kind": "NavigationProperty", "$isCollection$IsCollection": true, "$Type": "org.exampleself.Employee" }}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 9: entity type with a simple key"org.example.Category17": { "$kind$Kind": "EntityType", "$Key": [ "ID" ], "ID": { "$Type": "Edm.Int32", "$Nullable": false }, "Name": { "@Org.OData.Core.V1.IsLanguageDependent": true }}Example SEQ Example \* ARABIC 10: entity type with a simple key referencing a property of a complex type"org.example.Category": { "$kind$Kind": "EntityType", "$Key": [ { "EntityInfoID": "Info/ID" } ], "Info": { "$Type": "org.exampleself.EntityInfo", "$Nullable": false }, "Name": {}},"org.example.EntityInfo": { "$kind$Kind": "ComplexType", "ID": { "$Type": "Edm.Int32", "$Nullable": false }, "Created": { "$Type": "Edm.DateTimeOffset" }}Example 11: entity type with a composite key"org.example.OrderLine": { "$kind$Kind": "EntityType", "$Key": [ "OrderID", "LineNumber" ], "OrderID": { "$Type": "Edm.Int32", "$Nullable": false }, "LineNumber": { "$Type": "Edm.Int32", "$Nullable": false }}Example 12 (based on example REF ExampleNumberentityref \h 10): requests to an entity set Categories of type Category must use the alias(EntityInfoID=1)Example 13 (based on example REF ExampleNumberentityref \h 10): in a query part the value assigned to the name attribute must be used?$filter=Info/ID le 100Member $BaseTypeThe value of $BaseType is the namespace-qualifiedalias-qualified name of the base type.Member $AbstractThe value of $Abstract is one of the Boolean literals true or false. Absence of the member means false.Member $OpenTypeThe value of $OpenType is one of the Boolean literals true or false. Absence of the member means false. Member $HasStreamThe value of $HasStream is one of the Boolean literals true or false. Absence of the member means false. Structural 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 MAY contain the member $kind$Kind with a string value of Property. It MAY contain the member $Type, HYPERLINK \l "_Members_$Type_and" $isCollection$IsCollection, $Nullable, $MaxLength, $Precision, $Scale, $Unicode, $SRID, and $DefaultValue. It also MAY contain annotations.Example 14: complex type with two properties Dimension and Length"org.example.Measurement": { "$kind$Kind": "ComplexType", "Dimension": { "$Nullable": false, "$MaxLength": 50, "$DefaultValue": "Unspecified" }, "Length": { "$Type": "Edm.Decimal", "$Nullable": false, "$Precision": 18, "$Scale": 2 }}Members $Type and $isCollection$IsCollectionFor single-valued properties the value of $Type is the namespace-qualifiedalias-qualified name of the property’s type.For collection-valued properties the value of $Type is the namespace-qualifiedalias-qualified name of the property’s item type, and the member $isCollection$IsCollection MUST be present with the literal value true.Absence of the $Type member means the type is Edm.String.Example 15: property Units that can have zero or more strings as its value"Units": { "$isCollection$IsCollection": true}Member $NullableThe value of $Nullable is one of the Boolean literals true or false. Absence of the member means false.Member $MaxLengthThe value of $MaxLength is a 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 number.Member $ScaleThe value of $Scale is a number or a string with one of the symbolic values floating or variable.Member $UnicodeThe value of $Unicode is one of the Boolean literals true or false. Absence of the member means true. Member $SRIDThe value of $SRID is a string 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$Kind with a string value of NavigationProperty. It MUST contain the member $Type, and it MAY contain the members HYPERLINK \l "_Member_$Type_and" $isCollection$IsCollection, $Nullable, $Partner, $ContainsTarget, $ReferentialConstraint, and $OnDelete. It also MAY contain annotations. Annotations for $OnDelete are prefixed with $OnDelete.Example 16: 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$Kind": "EntityType", "$Key": [ "ID" ], "ID": { "$Nullable": false }, "CategoryID": { "$Nullable": false }, "Category": { "$kind$Kind": "NavigationProperty", "$Type": "org.exampleself.Category", "$Nullable": false, "$Partner": "Products", "$ReferentialConstraint": { "CategoryID": "ID" } }, "Supplier": { "$kind$Kind": "NavigationProperty", "$Type": "org.exampleself.Supplier" }},"org.example.Category": { "$kind$Kind": "EntityType", "$Key": [ "ID" ], "ID": { "$Nullable": false }, "Products": { "$kind$Kind": "NavigationProperty", "$isCollection$IsCollection": true, "$Type": "org.exampleself.Product", "$Partner": "Category", "$OnDelete": "Cascade", "$OnDelete@Org.OData.Core.V1.Description": "Delete all related entities" }}Member $Type and $isCollection$IsCollectionFor single-valued navigation properties the value of $Type is the namespace-qualifiedalias-qualified name of the navigation property’s type.For collection-valued navigation properties the value of $Type is the namespace-qualifiedalias-qualified name of the navigation property’s item type, and the member $isCollection$IsCollection MUST be present with the literal value true.Member $NullableThe value of $Nullable is one of the Boolean literals true or false. Absence of the member means true.Member $PartnerThe value of $Partner is a string containing the name of the partner navigation property.Member $ContainsTargetThe value of $ContainsTarget is one of the Boolean literals true or false. Absence of the member means false.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 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 SetDefault.Annotations for $OnDelete are prefixed with $plex TypeA complex type is represented as a member of the document schema object whose name is the namespace-qualifiedunqualified name of the complex type and whose value is an object.The value object MUST contain the member $kind$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 17: a complex type used by two entity types"org.example.Dimensions": { "$kind$Kind": "ComplexType", "Height": { "$Nullable": false, "$Type": "Edm.Decimal" }, "Weight": { "$Nullable": false, "$Type": "Edm.Decimal" }, "Length": { "$Nullable": false, "$Type": "Edm.Decimal" }},"org.example.Product": { … "ProductDimensions": { "$Type": "org.exampleself.Dimensions" }, "ShippingDimensions": { "$Type": "org.exampleself.Dimensions" }},"org.example.ShipmentBox": { … "Dimensions": { "$Type": "org.exampleself.Dimensions" }}Enumeration TypeAn enumeration type is represented as a member of the document schema object whose name is the namespace-qualifiedunqualified name of the enumeration type and whose value is an object.The value object MUST contain the member $kind$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 18: a simple flags-enabled enumeration"org.example.FileAccess": { "$kind$Kind": "EnumType", "$UnderlyingType": "Edm.Int32", "$IsFlags": true, "Read": 1, "Write": 2, "Create": 4, "Delete": 8}Example 19: FirstClass has a value of 0, TwoDay a value of 1, and Overnight a value of 2."org.example.ShippingMethod": { "$kind$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 20: pattern values can be combined, and some combined values have explicit names"org.example.Pattern": { "$kind$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-qualifiedalias-qualified name of the underlying type.Member $IsFlagsThe value of $IsFlags is one of the Boolean literals true or false. Absence of the member means false.Type DefinitionA type definition is represented as a member of the document schema object whose name is the namespace-qualifiedunqualified name of the type definition and whose value is an object.The value object MUST contain the member $kind$Kind with a string value of TypeDefinition and the member $UnderlyingType. It MAY contain the members $MaxLength, $Unicode, $Precision, $Scale, $Unicode, and $SRID, and it MAY contain annotations. Example 21: "org.example.Length": { "$kind$Kind": "TypeDefinition", "$UnderlyingType": "Edm.Int32", "@Org.OData.Measures.V1.Unit": "Centimeters"},"org.example.Weight": { "$kind$Kind": "TypeDefinition", "$UnderlyingType": "Edm.Int32", "@Org.OData.Measures.V1.Unit": "Kilograms"},"org.example.Size": { "$kind$Kind": "ComplexType", "Height": { "$Type": "org.exampleself.Length" }, "Weight": { "$Type": "org.exampleself.Weight" }}Member $UnderlyingTypeThe value of $UnderlyingType is the namespace-qualifiedalias-qualified name of the underlying type.Action and FunctionAn action or function is represented as a member of the document schema object whose name is the namespace-qualifiedunqualified 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$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$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 22: 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$Kind": "Function", "$Parameter": [ { "$Name": "Year", "$Type": "Edm.Decimal", "$Precision": 4, "$Scale": 0 } ], "$ReturnType": { "$isCollection$IsCollection": true, "$Type": "org.exampleself.Product" } }]Member $IsBoundThe value of $IsBound is one of the Boolean literals true or false. Absence of the member means false.Member $EntitySetPathThe value of $EntitySetPath is a string containing the entity set path.Member $IsComposableThe value of $IsComposable is one of the Boolean literals true or false. Absence of the member means false.Member $ReturnTypeThe value of $ReturnType is an object. It MAY contain the members $Type, HYPERLINK \l "_Members_$Type_and_1" $isCollection$IsCollection, $Nullable, $MaxLength, $Unicode, $Precision, $Scale, and $SRID. $Unicode, $Precision, $Scale, and $SRID. It also MAY contain annotations.Members $Type and $isCollection$IsCollectionFor single-valued return types the value of $Type is the namespace-qualifiedalias-qualified name of the returned type.For collection-valued return types the value of $Type is the namespace-qualifiedalias-qualified name of the returned item type, and the member $isCollection$IsCollection MUST be present with the literal value true.Absence of the $Type member means the type is Edm.String.Member $ParameterThe value of $Parameter is an array. The array contains one object per parameter.A parameter object MUST contain the member $Name, and it MAY contain the members $Type, HYPERLINK \l "_Members_$Type_and_2" $isCollection$IsCollection, $Nullable, $MaxLength, $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 $isCollection$IsCollectionFor single-valued parameters the value of $Type is the namespace-qualifiedalias-qualified name of the accepted type.For collection-valued parameters the value of $Type is the namespace-qualifiedalias-qualified name of the accepted item type, and the member $isCollection$IsCollection MUST be present with the literal value true.Absence of the $Type member means the type is Edm.String.Entity ContainerAn entity container is represented as two a members of the document schema 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-qualifiedunqualified 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 23: An entity container aggregates entity sets, singletons, action imports, and function imports."$EntityContainer": "org.example.DemoService","org.example.DemoService": { "$kind$Kind": "EntityContainer", "Products": { "$kind$Kind": "EntitySet", "$Type": "org.exampleself.Product", "$NavigationPropertyBinding": { "Category": "Categories", "Supplier": "Suppliers" }, "@org.example.displayUI.DisplayName": "Product Catalog" }, "Categories": { "$kind$Kind": "EntitySet", "$Type": "org.exampleself.Category", "$NavigationPropertyBinding": { "Products": "Products" } }, "Suppliers": { "$kind$Kind": "EntitySet", "$Type": "org.exampleself.Supplier", "$NavigationPropertyBinding": { "Products": "sSelf.DemoService" }, "@org.example.displayUI.DisplayName": "Supplier Directory" }, "MainSupplier": { "$kind$Kind": "Singleton", "$Type": "org.exampleself.Supplier" }, "LeaveRequestApproval": { "$kind$Kind": "ActionImport", "$Action": "org.exampleself.Approval" }, "ProductsByRating": { "$kind$Kind": "FunctionImport", "$EntitySet": "Products", "$Function": "ODataDemoself.ProductsByRating" }}Member $ExtendsThe value of $Extends is the namespace-qualifiedalias-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$Kind with a string value of EntitySet, and the member $Type whose string value is the namespace-qualifiedalias-qualified name of an entity type.It MAY contain the members $IncludeInServiceDocument and $NavigationPropertyBinding as well as annotations.Member $IncludeInServiceDocumentThe value of $IncludeInServiceDocument is one of the Boolean literals true or false. Absence of the member means true.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 24: for an entity set in the same container as the enclosing entity set Categories"Categories": { "$kind$Kind": "EntitySet", "$Type": "org.exampleself.Category", "$NavigationPropertyBinding": { "Products": "SomeSet" }}Example 25: for an entity set in any container in scope"Categories": { "$kind$Kind": "EntitySet", "$Type": "org.exampleself.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$Kind with a string value of Singleton, and the member $Type whose string value is the namespace-qualifiedalias-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$Kind with a string value of ActionImport, and the member $Action whose string value is the namespace-qualifiedalias-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$Kind with a string value of FunctionImport, and the member $Function whose string value is the namespace-qualifiedalias-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 one of the Boolean literals true or false. Absence of the member means false.Vocabulary and AnnotationTermA term is represented as a member of the document schema object whose name is the namespace-qualifiedunqualified name of the term and whose value is an object.The value object MUST contain the member $kind$Kind with a string value of Term. It MAY contain the members $Type, HYPERLINK \l "_Member_$Type_and_1" $isCollection$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 $isCollection$IsCollectionFor single-valued terms the value of $Type is the namespace-qualifiedalias-qualified name of the term’s type.For collection-valued terms the value of $Type is the namespace-qualifiedalias-qualified name of the term’s item type, and the member $isCollection$IsCollection MUST be present with the literal value true.Absence of the $Type member means the type is Edm.String.Member $BaseTermFor a specialized term the value of $BaseTerm is the qualified name of the base term.Member $AppliesToThe value of $AppliesTo is an array whose items are strings containing model element names the term can be applied to.Example 26: the IsURL term can be applied to properties and terms that are of type Edm.String"org.example2.IsURL": { "$kind$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-qualifiedalias-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 27: annotation should only be applied to tablet devices"@org.example.displayUI.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 28: base64url-encoded binary value (OData)"@org.example.displayUI.Thumbnail": { "$Binary": "T0RhdGE"}BooleanBoolean expressions are represented as the literals true or false.Example 29:"@org.example.displayUI.ReadOnly": trueDateDate expressions are represented as an object with a single member $Date whose value is a string containing the date value.Example 30:"@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 31:"@org.example.displayUI.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 32:"@org.example.displayUI.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 33:"@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. Numbers are used for safe integer enumeration values (less than or equal to 9007199254740991), strings are used for unsafe integers and symbolic enumeration values.Example 34: single value Red with numeric value"@org.exampleself.HasPattern": { "$EnumMember": 1}Example SEQ Example \* ARABIC 35: single value Red with symbolic value"@org.exampleself.HasPattern": { "$EnumMember": "Red"}Example 36: combined value Red,Striped with numeric value 1 + 16"@org.exampleself.HasPattern": { "$EnumMember": 17}Example SEQ Example \* ARABIC 37: combined value Red,Striped with symbolic value"@org.exampleself.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 38:"@org.example.displayUI.FloatWidth": 3.14,"@org.example.displayUI.FloatWidth": { "$Float": "INF"}GuidGuid expressions are represented as an object with a single member $Guid whose value is a string containing the guid value.Example 39:"@org.example.displayUI.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 40:"@An.Int": 1234,"@A.Very.Long.Int": { "$Int": "9007199254740992"}StringString expressions are represented as a string.Example 41:"@org.example.displayUI.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.Example SEQ Example \* ARABIC 42:"@org.example.displayUI.EndTime": { "$TimeOfDay": "21:45:00"}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 43:{ "$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 44:"@org.example.DisplayUI.ReferenceFacet": { "$AnnotationPath": "Product/Supplier/@org.example.DisplayUI.LineItem"},"@org.example.DisplayUI.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 45:"@org.example.displayUI.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 46: 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.exampleself.actorName" } ], "$Function": "odata.fillUriTemplate"}Function odata.uriEncodeThe function odata.uriEncode takes one expressions as its arguments and returns a string value. Example 47:{ "$Apply": [ "({genreName})", { "$LabeledElement": { "$Apply": [ { "$Path": "NameOfMovieGenre" } ], "$Function": "odata.uriEncode" }, "$Name": "org.exampleself.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-qualifiedalias-qualified type name.Example 48:"@org.example.displayUI.Threshold": { "$Cast": { "$Path": "Average" }, "$Type": "Edm.Decimal"}Collection ExpressionCollection expressions are represented as arrays with one item per expression within the collection.Example 49:"@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 and the optional third expression are evaluated conditionally.Example 50:"@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 an namespace-qualifiedalias-qualified type name.Example 51:"@Self.IsPreferredCustomer": { "$IsOf": { "$Path": "Customer" }, "$Type": "selforg.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 an namespace-qualifiedalias-qualified name. The namespace alias MUST be identical to the namespace alias of the schema containing the labeled element expression. Example 52:"@org.example.displayUI.DisplayName": { "$LabeledElement": { "$Path": "FirstName" }, "$Name": "org.exampleself.CustomerFirstName"}Labeled Element Reference ExpressionLabeled element reference expressions are represented as an object with a member $LabeledElementReference whose value is a string containing an namespace-qualifiedalias-qualified name.Example 53:"@org.example.displayUI.DisplayName": { "$LabeledElementReference": "org.exampleself.CustomerFirstName"}Null ExpressionNull expressions that do not contain annotations are represented as the literal null. Example 54:"@org.example.displayUI.DisplayName": null,Null expression containing annotations are represented as an object with a member $Null whose value is the literal null.Example 55:"@org.example.displayUI.Address": { "$Null": null, "@org.exampleself.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 56:"@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 57:"@org.example.displayUI.DisplayName": { "$Path": "FirstName"},"@org.example.displayUI.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 58:"@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 59: 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 60:"@Vocab.Supplier": { "$UrlRef": { "$Apply": [ "({suppID})", { "$LabeledElement": { "$Apply": [ { "$Path": "SupplierId" } ], "$Function": "odata.uriEncode" }, "$Name": "org.exampleself.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 61:{ "$Version": "4.01", "$EntityContainer": "ODataDemo.DemoService", "$Reference": { "": { "$Include": [ { "$Namespace": "Org.OData.Core.V1.", "$Alias": "Core", "@Org.OData.Core.V1.DefaultNamespace": true } ] }, "": { "$Include": [ { "$Namespace": "Org.OData.Measures.V1.", "$Alias": "Measures" } ] } }, "ODataDemo.": { "$kind$Kind": "Schema", "$Alias": "self", "@Org.OData.Core.V1.DefaultNamespace": true }, "ODataDemo.Product": { "$kind$Kind": "EntityType", "$HasStream": true, "$Key": [ "ID" ], "ID": { "$Nullable": false }, "Description": { "@Org.OData.Core.V1.IsLanguageDependent": true }, "ReleaseDate": { "$Type": "Edm.Date" }, "DiscontinuedDate": { "$Type": "Edm.Date" }, "Rating": { "$Type": "Edm.Int32" }, "Price": { "$Type": "Edm.Decimal", "@Org.OData.Measures.V1.ISOCurrency": { "$Path": "Currency" } }, "Currency": { "$MaxLength": 3 }, "Category": { "$kind$Kind": "NavigationProperty", "$Type": "ODataDemoself.Category", "$Nullable": false, "$Partner": "Products" }, "Supplier": { "$kind$Kind": "NavigationProperty", "$Type": "ODataDemoself.Supplier", "$Partner": "Products" } }, "ODataDemo.Category": { "$kind$Kind": "EntityType", "$Key": [ "ID" ], "ID": { "$Type": "Edm.Int32", "$Nullable": false }, "Name": { "$Nullable": false, "@Org.OData.Core.V1.IsLanguageDependent": true }, "Products": { "$kind$Kind": "NavigationProperty", "$Partner": "Category", "$isCollection$IsCollection": true, "$Type": "ODataDemoself.Product", "$OnDelete": "Cascade" } }, "ODataDemo.Supplier": { "$kind$Kind": "EntityType", "$Key": [ "ID" ], "ID": { "$Nullable": false }, "Name": {}, "Address": { "$Type": "ODataDemoself.Address", "$Nullable": false }, "Concurrency": { "$Type": "Edm.Int32", "$Nullable": false }, "Products": { "$kind$Kind": "NavigationProperty", "$Partner": "Supplier", "$isCollection$IsCollection": true, "$Type": "ODataDemoself.Product" } }, "ODataDemo.Country": { "$kind$Kind": "EntityType", "$Key": [ "Code" ], "Code": { "$MaxLength": 2, "$Nullable": false }, "Name": {} }, "ODataDemo.Address": { "$kind$Kind": "ComplexType", "Street": {}, "City": {}, "State": {}, "ZipCode": {}, "CountryName": {}, "Country": { "$kind$Kind": "NavigationProperty", "$Type": "ODataDemoself.Country", "$ReferentialConstraint": { "CountryName": "Name" } } }, "ODataDemo.ProductsByRating": [ { "$kind$Kind": "Function", "$Parameter": [ { "$Name": "Rating", "$Type": "Edm.Int32" } ], "$ReturnType": { "$isCollection$IsCollection": true, "$Type": "ODataDemoself.Product" } } ], "ODataDemo.DemoService": { "$kind$Kind": "EntityContainer", "Products": { "$kind$Kind": "EntitySet", "$Type": "ODataDemoself.Product", "$NavigationPropertyBinding": { "Category": "Categories" } }, "Categories": { "$kind$Kind": "EntitySet", "$Type": "ODataDemoself.Category", "$NavigationPropertyBinding": { "Products": "Products" }, "@Org.OData.Core.V1.Description": "Product Categories" }, "Suppliers": { "$kind$Kind": "EntitySet", "$Type": "ODataDemoself.Supplier", "$NavigationPropertyBinding": { "Products": "Products", "Address/Country": "Countries" }, "@Org.OData.Core.V1.OptimisticConcurrency": [ { "$PropertyPath": "Concurrency" } ] }, "Countries": { "$kind$Kind": "EntitySet", "$Type": "ODataDemoself.Country" }, "MainSupplier": { "$kind$Kind": "Singleton", "$Type": "ODataDemoself.Supplier", "$NavigationPropertyBinding": { "Products": "Products" }, "@Org.OData.Core.V1.Description": "Primary Supplier" }, "ProductsByRating": { "$kind$Kind": "FunctionImport", "$EntitySet": "Products", "$Function": "ODataDemoself.ProductsByRating" } } }}Annotations for Products and Categories Example Example 62:{ "$Version": "4.01", "$Reference": { "$metadata": { "$Include": [ { "$Namespace": "ODataDemo.", "$Alias": "target" } ] }, "": { "$Include": [ { "$Namespace": "Some.Vocabulary.V1.", "$Alias": "Vocabulary1" } ] } }, "External.Annotations.": { "$kind$Kind": "Schema", "$Alias": "self", "$Annotations": { "ODataDemotarget.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 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 Edm.AnyPath and Edm.AnyPropertyPath MUST NOT specify referential constraints 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 [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