Skip to content

Commit fe22a67

Browse files
Merge pull request #834 from microsoftgraph/ramsess/instancesAndExceptionOccurences-navAnnotation
Add navigability annotations for 'instances' and 'exceptionOccurrences'
2 parents 164065a + 284e581 commit fe22a67

File tree

3 files changed

+129
-1
lines changed

3 files changed

+129
-1
lines changed

transforms/csdl/preprocess_csdl.xsl

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,43 @@
969969
</xsl:element>
970970
</xsl:element>
971971
</xsl:element>
972+
<!--Add readRestcitions to Instances through annotations. Instances is readble, but not indexable or readableByKey-->
973+
<xsl:call-template name="ReadRestrictionsTemplate">
974+
<xsl:with-param name="readable">true</xsl:with-param>
975+
<xsl:with-param name="readableByKey">false</xsl:with-param>
976+
</xsl:call-template>
977+
<xsl:call-template name="IndexableByKeyTemplate">
978+
<xsl:with-param name="indexableByKey">false</xsl:with-param>
979+
</xsl:call-template>
980+
</xsl:copy>
981+
</xsl:template>
982+
983+
<!--Add readRestcitions to CalendarView through annotations. CalendarView is readble, but not indexable or readableByKey-->
984+
<!--https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Capabilities.V1.md#ReadByKeyRestrictionsType-->
985+
<!--https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Capabilities.V1.md#defaultcapabilitiestype-->
986+
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']/edm:EntityType[@Name='bookingBusiness']/edm:NavigationProperty[@Name='calendarView']|
987+
edm:Schema[@Namespace='microsoft.graph']/edm:EntityType[@Name='calendar']/edm:NavigationProperty[@Name='calendarView']|
988+
edm:Schema[@Namespace='microsoft.graph']/edm:EntityType[@Name='group']/edm:NavigationProperty[@Name='calendarView']|
989+
edm:Schema[@Namespace='microsoft.graph']/edm:EntityType[@Name='user']/edm:NavigationProperty[@Name='calendarView']">
990+
<xsl:copy>
991+
<xsl:apply-templates select="@* | node()"/>
992+
<xsl:call-template name="ReadRestrictionsTemplate">
993+
<xsl:with-param name="readable">true</xsl:with-param>
994+
<xsl:with-param name="readableByKey">false</xsl:with-param>
995+
</xsl:call-template>
996+
<xsl:call-template name="IndexableByKeyTemplate">
997+
<xsl:with-param name="indexableByKey">false</xsl:with-param>
998+
</xsl:call-template>
999+
</xsl:copy>
1000+
</xsl:template>
1001+
<!--Remove exceptionOccurrences from all URI and navigation paths by adding NavigrationRestriction annotations-->
1002+
<!--https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Capabilities.V1.md#navigationrestrictionstype-->
1003+
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']/edm:EntityType[@Name='event']/edm:NavigationProperty[@Name='exceptionOccurrences']">
1004+
<xsl:copy>
1005+
<xsl:copy-of select="@* | node()" />
1006+
<xsl:call-template name="NavigationRestrictionsTemplate">
1007+
<xsl:with-param name="navigability">None</xsl:with-param>
1008+
</xsl:call-template>
9721009
</xsl:copy>
9731010
</xsl:template>
9741011

@@ -1375,7 +1412,7 @@
13751412
</xsl:template>
13761413

13771414
<!-- Add Navigation Restrictions Annotations -->
1378-
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']">
1415+
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']">
13791416
<xsl:copy>
13801417
<xsl:apply-templates select="@* | node()"/>
13811418

transforms/csdl/preprocess_csdl_test_input.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,42 @@
1919
<Property Name="ruleName" Type="Edm.String" />
2020
<NavigationProperty Name="scheduledActionConfigurations" Type="Collection(graph.deviceManagementComplianceActionItem)" />
2121
</EntityType>
22+
<EntityType Name="event" BaseType="graph.outlookItem" OpenType="true">
23+
<NavigationProperty Name="exceptionOccurrences" Type="Collection(graph.event)" ContainsTarget="true" />
24+
<NavigationProperty Name="instances" Type="Collection(graph.event)" ContainsTarget="true">
25+
<Annotation Term="Org.OData.Capabilities.V1.NavigationRestrictions">
26+
<Record>
27+
<PropertyValue Property="RestrictedProperties">
28+
<Collection>
29+
<Record>
30+
<PropertyValue Property="NavigationProperty">
31+
<PropertyPath>instances</PropertyPath>
32+
</PropertyValue>
33+
<PropertyValue Property="ReadRestrictions">
34+
<Record>
35+
<PropertyValue Property="CustomQueryOptions">
36+
<Collection>
37+
<Record>
38+
<PropertyValue Property="Name" String="startDateTime" />
39+
<PropertyValue Property="Description" String="The start date and time of the time range, represented in ISO 8601 format. For example, 2019-11-08T19:00:00-08:00" />
40+
<PropertyValue Property="Required" Bool="true" />
41+
</Record>
42+
<Record>
43+
<PropertyValue Property="Name" String="endDateTime" />
44+
<PropertyValue Property="Description" String="The end date and time of the time range, represented in ISO 8601 format. For example, 2019-11-08T20:00:00-08:00" />
45+
<PropertyValue Property="Required" Bool="true" />
46+
</Record>
47+
</Collection>
48+
</PropertyValue>
49+
</Record>
50+
</PropertyValue>
51+
</Record>
52+
</Collection>
53+
</PropertyValue>
54+
</Record>
55+
</Annotation>
56+
</NavigationProperty>
57+
</EntityType>
2258
<EntityType Name="plannerPlan" BaseType="graph.entity">
2359
<Property Name="createdBy" Type="graph.identitySet" />
2460
<Property Name="createdDateTime" Type="Edm.DateTimeOffset" />

transforms/csdl/preprocess_csdl_test_output.xml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,61 @@
5454
<Property Name="ruleName" Type="Edm.String" />
5555
<NavigationProperty Name="scheduledActionConfigurations" Type="Collection(graph.deviceManagementComplianceActionItem)" ContainsTarget="true" />
5656
</EntityType>
57+
<EntityType Name="event" BaseType="graph.outlookItem" OpenType="true">
58+
<NavigationProperty Name="exceptionOccurrences" Type="Collection(graph.event)" ContainsTarget="true">
59+
<Annotation Term="Org.OData.Capabilities.V1.NavigationRestrictions">
60+
<Record>
61+
<PropertyValue Property="Navigability">
62+
<EnumMember>Org.OData.Capabilities.V1.NavigationType/None</EnumMember>
63+
</PropertyValue>
64+
</Record>
65+
</Annotation>
66+
</NavigationProperty>
67+
<NavigationProperty Name="instances" Type="Collection(graph.event)" ContainsTarget="true">
68+
<Annotation Term="Org.OData.Capabilities.V1.NavigationRestrictions">
69+
<Record>
70+
<PropertyValue Property="RestrictedProperties">
71+
<Collection>
72+
<Record>
73+
<PropertyValue Property="NavigationProperty">
74+
<PropertyPath>instances</PropertyPath>
75+
</PropertyValue>
76+
<PropertyValue Property="ReadRestrictions">
77+
<Record>
78+
<PropertyValue Property="CustomQueryOptions">
79+
<Collection>
80+
<Record>
81+
<PropertyValue Property="Name" String="startDateTime" />
82+
<PropertyValue Property="Description" String="The start date and time of the time range, represented in ISO 8601 format. For example, 2019-11-08T19:00:00-08:00" />
83+
<PropertyValue Property="Required" Bool="true" />
84+
</Record>
85+
<Record>
86+
<PropertyValue Property="Name" String="endDateTime" />
87+
<PropertyValue Property="Description" String="The end date and time of the time range, represented in ISO 8601 format. For example, 2019-11-08T20:00:00-08:00" />
88+
<PropertyValue Property="Required" Bool="true" />
89+
</Record>
90+
</Collection>
91+
</PropertyValue>
92+
</Record>
93+
</PropertyValue>
94+
</Record>
95+
</Collection>
96+
</PropertyValue>
97+
</Record>
98+
</Annotation>
99+
<Annotation Term="Org.OData.Capabilities.V1.ReadRestrictions">
100+
<Record>
101+
<PropertyValue Property="Readable" Bool="true" />
102+
<PropertyValue Property="ReadByKeyRestrictions">
103+
<Record>
104+
<PropertyValue Property="Readable" Bool="false" />
105+
</Record>
106+
</PropertyValue>
107+
</Record>
108+
</Annotation>
109+
<Annotation Term="Org.OData.Capabilities.V1.IndexableByKey" Bool="false" />
110+
</NavigationProperty>
111+
</EntityType>
57112
<EntityType Name="plannerPlan" BaseType="graph.entity">
58113
<Property Name="createdBy" Type="graph.identitySet" />
59114
<Property Name="createdDateTime" Type="Edm.DateTimeOffset" />

0 commit comments

Comments
 (0)