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
28 changes: 27 additions & 1 deletion transforms/csdl/preprocess_csdl.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@
</xsl:copy>
</xsl:template>

<!-- Capability Annotations Templates -->
<xsl:template name="DeleteRestrictionsTemplate">
<xsl:param name = "deletable" />
<xsl:element name="Annotation">
Expand All @@ -556,6 +557,18 @@
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template name="InsertRestrictionsTemplate">
<xsl:param name = "insertable" />
<xsl:element name="Annotation">
<xsl:attribute name="Term">Org.OData.Capabilities.V1.InsertRestrictions</xsl:attribute>
<xsl:element name="Record" namespace="{namespace-uri()}">
<xsl:element name="PropertyValue">
<xsl:attribute name="Property">Insertable</xsl:attribute>
<xsl:attribute name="Bool"><xsl:value-of select = "$insertable" /></xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:template>

<!-- Add Navigation Restrictions Annotations -->
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']">
Expand Down Expand Up @@ -666,7 +679,7 @@
</xsl:element>
</xsl:element>
</xsl:element>
<!-- Remove deletability from navigation properties -->
<!-- Remove deletability -->
<xsl:element name="Annotations">
<xsl:attribute name="Target">microsoft.graph.security/alerts</xsl:attribute>
<xsl:call-template name="DeleteRestrictionsTemplate">
Expand All @@ -679,6 +692,19 @@
<xsl:with-param name="deletable">false</xsl:with-param>
</xsl:call-template>
</xsl:element>
<xsl:element name="Annotations">
<xsl:attribute name="Target">microsoft.graph.site</xsl:attribute>
<xsl:call-template name="DeleteRestrictionsTemplate">
<xsl:with-param name="deletable">false</xsl:with-param>
</xsl:call-template>
</xsl:element>
<!-- Remove insertability -->
<xsl:element name="Annotations">
<xsl:attribute name="Target">microsoft.graph.site</xsl:attribute>
<xsl:call-template name="InsertRestrictionsTemplate">
<xsl:with-param name="insertable">false</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:copy>
</xsl:template>

Expand Down
14 changes: 14 additions & 0 deletions transforms/csdl/preprocess_csdl_test_output.xml
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,20 @@
</Record>
</Annotation>
</Annotations>
<Annotations Target="microsoft.graph.site">
<Annotation Term="Org.OData.Capabilities.V1.DeleteRestrictions">
<Record>
<PropertyValue Property="Deletable" Bool="false" />
</Record>
</Annotation>
</Annotations>
<Annotations Target="microsoft.graph.site">
<Annotation Term="Org.OData.Capabilities.V1.InsertRestrictions">
<Record>
<PropertyValue Property="Insertable" Bool="false" />
</Record>
</Annotation>
</Annotations>
</Schema>
<Schema Namespace="microsoft.graph.callRecords" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<EnumType Name="callType">
Expand Down