Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion transforms/csdl/preprocess_csdl.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,43 @@
</xsl:element>
</xsl:element>
</xsl:element>
<!--Add readRestcitions to Instances through annotations. Instances is readble, but not indexable or readableByKey-->
<xsl:call-template name="ReadRestrictionsTemplate">
<xsl:with-param name="readable">true</xsl:with-param>
<xsl:with-param name="readableByKey">false</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="IndexableByKeyTemplate">
<xsl:with-param name="indexableByKey">false</xsl:with-param>
</xsl:call-template>
</xsl:copy>
</xsl:template>

<!--Add readRestcitions to CalendarView through annotations. CalendarView is readble, but not indexable or readableByKey-->
<!--https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Capabilities.V1.md#ReadByKeyRestrictionsType-->
<!--https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Capabilities.V1.md#defaultcapabilitiestype-->
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']/edm:EntityType[@Name='bookingBusiness']/edm:NavigationProperty[@Name='calendarView']|
edm:Schema[@Namespace='microsoft.graph']/edm:EntityType[@Name='calendar']/edm:NavigationProperty[@Name='calendarView']|
edm:Schema[@Namespace='microsoft.graph']/edm:EntityType[@Name='group']/edm:NavigationProperty[@Name='calendarView']|
edm:Schema[@Namespace='microsoft.graph']/edm:EntityType[@Name='user']/edm:NavigationProperty[@Name='calendarView']">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
<xsl:call-template name="ReadRestrictionsTemplate">
<xsl:with-param name="readable">true</xsl:with-param>
<xsl:with-param name="readableByKey">false</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="IndexableByKeyTemplate">
<xsl:with-param name="indexableByKey">false</xsl:with-param>
</xsl:call-template>
</xsl:copy>
</xsl:template>
<!--Remove exceptionOccurrences from all URI and navigation paths by adding NavigrationRestriction annotations-->
<!--https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Capabilities.V1.md#navigationrestrictionstype-->
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']/edm:EntityType[@Name='event']/edm:NavigationProperty[@Name='exceptionOccurrences']">
<xsl:copy>
<xsl:copy-of select="@* | node()" />
<xsl:call-template name="NavigationRestrictionsTemplate">
<xsl:with-param name="navigability">None</xsl:with-param>
</xsl:call-template>
</xsl:copy>
</xsl:template>

Expand Down Expand Up @@ -1375,7 +1412,7 @@
</xsl:template>

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

Expand Down
36 changes: 36 additions & 0 deletions transforms/csdl/preprocess_csdl_test_input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,42 @@
<Property Name="ruleName" Type="Edm.String" />
<NavigationProperty Name="scheduledActionConfigurations" Type="Collection(graph.deviceManagementComplianceActionItem)" />
</EntityType>
<EntityType Name="event" BaseType="graph.outlookItem" OpenType="true">
<NavigationProperty Name="exceptionOccurrences" Type="Collection(graph.event)" ContainsTarget="true" />
<NavigationProperty Name="instances" Type="Collection(graph.event)" ContainsTarget="true">
<Annotation Term="Org.OData.Capabilities.V1.NavigationRestrictions">
<Record>
<PropertyValue Property="RestrictedProperties">
<Collection>
<Record>
<PropertyValue Property="NavigationProperty">
<PropertyPath>instances</PropertyPath>
</PropertyValue>
<PropertyValue Property="ReadRestrictions">
<Record>
<PropertyValue Property="CustomQueryOptions">
<Collection>
<Record>
<PropertyValue Property="Name" String="startDateTime" />
<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" />
<PropertyValue Property="Required" Bool="true" />
</Record>
<Record>
<PropertyValue Property="Name" String="endDateTime" />
<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" />
<PropertyValue Property="Required" Bool="true" />
</Record>
</Collection>
</PropertyValue>
</Record>
</PropertyValue>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</NavigationProperty>
</EntityType>
<EntityType Name="plannerPlan" BaseType="graph.entity">
<Property Name="createdBy" Type="graph.identitySet" />
<Property Name="createdDateTime" Type="Edm.DateTimeOffset" />
Expand Down
55 changes: 55 additions & 0 deletions transforms/csdl/preprocess_csdl_test_output.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,61 @@
<Property Name="ruleName" Type="Edm.String" />
<NavigationProperty Name="scheduledActionConfigurations" Type="Collection(graph.deviceManagementComplianceActionItem)" ContainsTarget="true" />
</EntityType>
<EntityType Name="event" BaseType="graph.outlookItem" OpenType="true">
<NavigationProperty Name="exceptionOccurrences" Type="Collection(graph.event)" ContainsTarget="true">
<Annotation Term="Org.OData.Capabilities.V1.NavigationRestrictions">
<Record>
<PropertyValue Property="Navigability">
<EnumMember>Org.OData.Capabilities.V1.NavigationType/None</EnumMember>
</PropertyValue>
</Record>
</Annotation>
</NavigationProperty>
<NavigationProperty Name="instances" Type="Collection(graph.event)" ContainsTarget="true">
<Annotation Term="Org.OData.Capabilities.V1.NavigationRestrictions">
<Record>
<PropertyValue Property="RestrictedProperties">
<Collection>
<Record>
<PropertyValue Property="NavigationProperty">
<PropertyPath>instances</PropertyPath>
</PropertyValue>
<PropertyValue Property="ReadRestrictions">
<Record>
<PropertyValue Property="CustomQueryOptions">
<Collection>
<Record>
<PropertyValue Property="Name" String="startDateTime" />
<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" />
<PropertyValue Property="Required" Bool="true" />
</Record>
<Record>
<PropertyValue Property="Name" String="endDateTime" />
<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" />
<PropertyValue Property="Required" Bool="true" />
</Record>
</Collection>
</PropertyValue>
</Record>
</PropertyValue>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Org.OData.Capabilities.V1.ReadRestrictions">
<Record>
<PropertyValue Property="Readable" Bool="true" />
<PropertyValue Property="ReadByKeyRestrictions">
<Record>
<PropertyValue Property="Readable" Bool="false" />
</Record>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Org.OData.Capabilities.V1.IndexableByKey" Bool="false" />
</NavigationProperty>
</EntityType>
<EntityType Name="plannerPlan" BaseType="graph.entity">
<Property Name="createdBy" Type="graph.identitySet" />
<Property Name="createdDateTime" Type="Edm.DateTimeOffset" />
Expand Down
Loading