Skip to content

Commit

Permalink
Remove indexability for invitations
Browse files Browse the repository at this point in the history
  • Loading branch information
irvinesunday committed Jun 10, 2024
1 parent f5a7669 commit fc69395
Showing 1 changed file with 43 additions and 15 deletions.
58 changes: 43 additions & 15 deletions transforms/csdl/preprocess_csdl.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,16 @@
</xsl:template>

<!-- Capability Annotations Templates -->
<xsl:template name="IndexableByKeyTemplate">
<xsl:param name="indexableByKey" />
<xsl:element name="Annotation">
<xsl:attribute name="Term">Org.OData.Capabilities.V1.IndexableByKey</xsl:attribute>
<xsl:attribute name="Bool">
<xsl:value-of select="$indexableByKey"/>
</xsl:attribute>
</xsl:element>
</xsl:template>

<xsl:template name="CountRestrictionsTemplate">
<xsl:param name="countable" />
<xsl:element name="Annotation">
Expand Down Expand Up @@ -1823,28 +1833,46 @@
</xsl:element>
</xsl:when>
</xsl:choose>

<!-- Set IndexableByKey to false for GraphService/invitations -->
<xsl:choose>
<xsl:when test="not(edm:Annotations[@Target='microsoft.graph.GraphService/invitations'])">
<xsl:element name="Annotations">
<xsl:attribute name="Target">microsoft.graph.GraphService/invitations</xsl:attribute>
<xsl:call-template name="IndexableByKeyTemplate">
<xsl:with-param name="indexableByKey">false</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
</xsl:choose>

</xsl:copy>
</xsl:template>

<!-- If the grand-parent "Annotations" tag already exists modify it -->
<!-- Set IndexableByKey to false for GraphService/invitations -->
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']/edm:Annotations[@Target='microsoft.graph.GraphService/invitations']">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:if test="not(edm:Annotation[@Term='Org.OData.Capabilities.V1.IndexableByKey'])">
<xsl:call-template name="IndexableByKeyTemplate">
<xsl:with-param name="indexableByKey">false</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:copy>
</xsl:template>

<!-- If the grand-parent "Annotations" tag already exists modify it -->
<!-- Add deletability for directory/deletedItems -->
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']/edm:Annotations[@Target='microsoft.graph.directory/deletedItems'] ">
<xsl:choose>
<xsl:when test="not(edm:Annotation[@Term='Org.OData.Capabilities.V1.DeleteRestrictions'])">
<xsl:copy>
<xsl:copy-of select="@*|node()"/>
<xsl:call-template name="DeleteRestrictionsTemplate">
<xsl:with-param name="deletable">true</xsl:with-param>
</xsl:call-template>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:if test="not(edm:Annotation[@Term='Org.OData.Capabilities.V1.DeleteRestrictions'])">
<xsl:call-template name="DeleteRestrictionsTemplate">
<xsl:with-param name="deletable">true</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:copy>
</xsl:template>

<!-- If the parent "Annotation" tag already exists, modify it -->
Expand Down

0 comments on commit fc69395

Please sign in to comment.