Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into Common.skip
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen committed Sep 30, 2022
2 parents b410aff + 8467d82 commit bd155be
Show file tree
Hide file tree
Showing 35 changed files with 2,341 additions and 1,163 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This repository defines the following SAP vocabularies:
- [Hierarchy: Hierarchies](vocabularies/Hierarchy.md) - _experimental_
- [HTML5: Rendering directives for UI5](vocabularies/HTML5.md)
- [ODM: One Domain Model](vocabularies/ODM.md) - _experimental_
- [PDF: PDF response format](vocabularies/PDF.md) - _experimental_
- [PersonalData: Personal data / GDPR](vocabularies/PersonalData.md)
- [Session: Sticky Sessions](vocabularies/Session.md)
- [UI: Representing data in user interfaces](vocabularies/UI.md)
Expand Down
16 changes: 5 additions & 11 deletions examples/DynamicProperties-sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
],
"Order": {},
"Country": {},
"NumberOfItems": {
"$Type": "Edm.Int16"
},
"Amount": {
"$Type": "Edm.Decimal",
"$Nullable": true,
Expand All @@ -46,12 +43,12 @@
},
"$Annotations": {
"self.Sales": {
"@Analytics.AggregatedProperty#sum": {
"@Analytics.AggregatedProperty#sumAmount": {
"Name": "Total",
"AggregationMethod": "sum",
"AggregatableProperty": "Amount"
},
"@Analytics.AggregatedProperty#max": {
"@Analytics.AggregatedProperty#maxAmount": {
"Name": "Maximum",
"AggregationMethod": "max",
"AggregatableProperty": "Amount"
Expand All @@ -61,18 +58,15 @@
"Dimensions": [
"Country"
],
"Measures": [
"NumberOfItems"
],
"DynamicMeasures": [
"@Analytics.AggregatedProperty#sum",
"@Analytics.AggregatedProperty#sumAmount",
"/self.Container/me/[email protected]#WeightedAverage"
]
},
"@UI.SelectionVariant": {
"SelectOptions": [
{
"DynamicPropertyName": "@Analytics.AggregatedProperty#sum",
"DynamicPropertyName": "@Analytics.AggregatedProperty#sumAmount",
"Ranges": [
{
"Sign": "I",
Expand All @@ -89,7 +83,7 @@
"Property": "Country"
},
{
"DynamicProperty": "@Analytics.AggregatedProperty#sum",
"DynamicProperty": "@Analytics.AggregatedProperty#sumAmount",
"Descending": true
},
{
Expand Down
16 changes: 5 additions & 11 deletions examples/DynamicProperties-sample.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@
</Key>
<Property Name="Order" Type="Edm.String" Nullable="false" />
<Property Name="Country" Type="Edm.String" Nullable="false" />
<Property Name="NumberOfItems" Type="Edm.Int16" Nullable="false" />
<Property Name="Amount" Type="Edm.Decimal" />
</EntityType>

<Annotations Target="self.Sales">
<Annotation Term="Analytics.AggregatedProperty" Qualifier="sum">
<Annotation Term="Analytics.AggregatedProperty" Qualifier="sumAmount">
<Record>
<PropertyValue Property="Name" String="Total" />
<PropertyValue Property="AggregationMethod" String="sum" />
<PropertyValue Property="AggregatableProperty" PropertyPath="Amount" />
</Record>
</Annotation>

<Annotation Term="Analytics.AggregatedProperty" Qualifier="max">
<Annotation Term="Analytics.AggregatedProperty" Qualifier="maxAmount">
<Record>
<PropertyValue Property="Name" String="Maximum" />
<PropertyValue Property="AggregationMethod" String="max" />
Expand All @@ -47,14 +46,9 @@
<PropertyPath>Country</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="Measures">
<Collection>
<PropertyPath>NumberOfItems</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="DynamicMeasures">
<Collection>
<AnnotationPath>@Analytics.AggregatedProperty#sum</AnnotationPath>
<AnnotationPath>@Analytics.AggregatedProperty#sumAmount</AnnotationPath>
<AnnotationPath>/self.Container/me/[email protected]#WeightedAverage</AnnotationPath>
</Collection>
</PropertyValue>
Expand All @@ -69,7 +63,7 @@
<PropertyValue Property="SelectOptions">
<Collection>
<Record>
<PropertyValue Property="DynamicPropertyName" AnnotationPath="@Analytics.AggregatedProperty#sum" />
<PropertyValue Property="DynamicPropertyName" AnnotationPath="@Analytics.AggregatedProperty#sumAmount" />
<PropertyValue Property="Ranges">
<Collection>
<Record>
Expand All @@ -93,7 +87,7 @@
<PropertyValue Property="Property" PropertyPath="Country" />
</Record>
<Record>
<PropertyValue Property="DynamicProperty" AnnotationPath="@Analytics.AggregatedProperty#sum" />
<PropertyValue Property="DynamicProperty" AnnotationPath="@Analytics.AggregatedProperty#sumAmount" />
<PropertyValue Property="Descending" Bool="true" />
</Record>
<Record>
Expand Down
46 changes: 46 additions & 0 deletions examples/PDF.Features-examples.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$Version": "4.0",
"$Reference": {
"https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.json": {
"$Include": [
{
"$Namespace": "Org.OData.Core.V1",
"$Alias": "Core"
}
]
},
"https://sap.github.io/odata-vocabularies/vocabularies/PDF.json": {
"$Include": [
{
"$Namespace": "com.sap.vocabularies.PDF.v1",
"$Alias": "PDF"
}
]
}
},
"PDF.examples": {
"Container": {
"$Kind": "EntityContainer",
"@Core.Description": "Imagine some entity sets here"
},
"$Annotations": {
"PDF.examples/Container": {
"@PDF.Features": {
"DocumentDescriptionReference": "../../../../default/iwbep/common/0001/$metadata",
"DocumentDescriptionCollection": "MyDocumentDescriptions",
"ArchiveFormat": true,
"Signature": true,
"CoverPage": true,
"FontSize": true,
"FontName": true,
"Margin": true,
"Border": true,
"FitToPage": false,
"ResultSizeDefault": 5000,
"ResultSizeMaximum": 50000
}
}
}
},
"$EntityContainer": "PDF.examples.Container"
}
39 changes: 39 additions & 0 deletions examples/PDF.Features-examples.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Namespace="Org.OData.Core.V1" Alias="Core" />
</edmx:Reference>

<edmx:Reference Uri="https://sap.github.io/odata-vocabularies/vocabularies/PDF.xml">
<edmx:Include Namespace="com.sap.vocabularies.PDF.v1" Alias="PDF" />
</edmx:Reference>
<edmx:DataServices>
<Schema Namespace="PDF.examples" xmlns="http://docs.oasis-open.org/odata/ns/edm">

<EntityContainer Name="Container">
<Annotation Term="Core.Description" String="Imagine some entity sets here" />
</EntityContainer>

<Annotations Target="PDF.examples/Container">
<Annotation Term="PDF.Features">
<Record>
<PropertyValue Property="DocumentDescriptionReference" String="../../../../default/iwbep/common/0001/$metadata" />
<PropertyValue Property="DocumentDescriptionCollection" String="MyDocumentDescriptions" />
<PropertyValue Property="ArchiveFormat" Bool="true" />
<PropertyValue Property="Signature" Bool="true" />
<PropertyValue Property="CoverPage" Bool="true" />
<PropertyValue Property="FontSize" Bool="true" />
<PropertyValue Property="FontName" Bool="true" />
<PropertyValue Property="Margin" Bool="true" />
<PropertyValue Property="Border" Bool="true" />
<PropertyValue Property="FitToPage" Bool="false" />
<PropertyValue Property="ResultSizeDefault" Int="5000" />
<PropertyValue Property="ResultSizeMaximum" Int="50000" />
</Record>
</Annotation>
</Annotations>


</Schema>
</edmx:DataServices>
</edmx:Edmx>
85 changes: 85 additions & 0 deletions examples/UI.IsCopyAction-sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"$Version": "4.0",
"$Reference": {
"https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.json": {
"$Include": [
{
"$Namespace": "Org.OData.Core.V1",
"$Alias": "Core"
}
]
},
"https://sap.github.io/odata-vocabularies/vocabularies/UI.json": {
"$Include": [
{
"$Namespace": "com.sap.vocabularies.UI.v1",
"$Alias": "UI"
}
]
}
},
"UI.examples": {
"$Alias": "this",
"container": {
"$Kind": "EntityContainer",
"SalesOrder": {
"$Collection": true,
"$Type": "this.SalesOrder_Type"
}
},
"SalesOrder_Type": {
"$Kind": "EntityType",
"$Key": [
"SalesOrder"
],
"SalesOrder": {
"$MaxLength": 10
},
"canBeCopied": {
"$Type": "Edm.Boolean",
"$Nullable": true
},
"hideCopyButton": {
"$Type": "Edm.Boolean",
"$Nullable": true
}
},
"Copy": [
{
"$Kind": "Action",
"$IsBound": true,
"$Parameter": [
{
"$Name": "it",
"$Type": "this.SalesOrder_Type",
"$Nullable": true
}
],
"$ReturnType": {
"$Type": "this.SalesOrder_Type",
"$Nullable": true
}
}
],
"$Annotations": {
"this.Copy": {
"@Core.OperationAvailable": {
"$Path": "it/canBeCopied"
}
},
"this.SalesOrder_Type": {
"@UI.LineItem": [
{
"@odata.type": "https://sap.github.io/odata-vocabularies/vocabularies/UI.xml#UI.DataFieldForAction",
"@UI.Hidden": {
"$Path": "hideCopyButton"
},
"@UI.IsCopyAction": true,
"Action": "this.Copy"
}
]
}
}
},
"$EntityContainer": "UI.examples.container"
}
53 changes: 53 additions & 0 deletions examples/UI.IsCopyAction-sample.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Namespace="Org.OData.Core.V1" Alias="Core" />
</edmx:Reference>

<edmx:Reference Uri="https://sap.github.io/odata-vocabularies/vocabularies/UI.xml">
<edmx:Include Namespace="com.sap.vocabularies.UI.v1" Alias="UI" />
</edmx:Reference>

<edmx:DataServices>
<Schema Namespace="UI.examples" xmlns="http://docs.oasis-open.org/odata/ns/edm" Alias="this">

<EntityContainer Name="container">
<EntitySet Name="SalesOrder" EntityType="this.SalesOrder_Type" />
</EntityContainer>

<EntityType Name="SalesOrder_Type">
<Key>
<PropertyRef Name="SalesOrder" />
</Key>
<Property Name="SalesOrder" Type="Edm.String" Nullable="false" MaxLength="10" />
<Property Name="canBeCopied" Type="Edm.Boolean" Nullable="true" />
<Property Name="hideCopyButton" Type="Edm.Boolean" Nullable="true" />
<!-- ... and a lot more -->
</EntityType>

<Action Name="Copy" IsBound="true">
<Parameter Name="it" Type="this.SalesOrder_Type" />
<ReturnType Type="this.SalesOrder_Type"></ReturnType>
</Action>

<Annotations Target="this.Copy">
<!-- property canBeCopied of the bound instance controls whether the Copy action is available on that instance -->
<Annotation Term="Core.OperationAvailable" Path="it/canBeCopied" />
</Annotations>

<Annotations Target="this.SalesOrder_Type">
<Annotation Term="UI.LineItem">
<Collection>
<Record Type="UI.DataFieldForAction">
<Annotation Term="UI.Hidden" Path="hideCopyButton" />
<Annotation Term="UI.IsCopyAction" Bool="true" />
<PropertyValue Property="Action" String="this.Copy" />
</Record>
<!-- ... and some more -->
</Collection>
</Annotation>
</Annotations>

</Schema>
</edmx:DataServices>
</edmx:Edmx>
4 changes: 2 additions & 2 deletions lib/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fs.readdirSync(vocabFolder)
const xml = fs.readFileSync(vocabFolder + xmlfile, "utf8");
let json;
try {
json = csdl.xml2json(xml, true);
json = csdl.xml2json(xml, { strict: true, lineNumbers: true });
} catch (e) {
console.error(
colors.red(
Expand Down Expand Up @@ -62,7 +62,7 @@ fs.readdirSync(exampleFolder)
const xml = fs.readFileSync(exampleFolder + xmlfile, "utf8");
let json;
try {
json = csdl.xml2json(xml, false);
json = csdl.xml2json(xml, { strict: true });
} catch (e) {
console.error(
colors.red(
Expand Down
Loading

0 comments on commit bd155be

Please sign in to comment.