Skip to content

Commit

Permalink
Adding Readable for authenticationEventsFlow/conditions complex p…
Browse files Browse the repository at this point in the history
…roperty (#497)

* Update tests

* Add readability for complex property
  • Loading branch information
irvinesunday authored Nov 14, 2023
1 parent 41e99a6 commit bb9eca9
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
45 changes: 45 additions & 0 deletions transforms/csdl/preprocess_csdl.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,18 @@
</xsl:element>
</xsl:when>
</xsl:choose>

<!-- Add readability for complex property authenticationEventsFlow/conditions -->
<xsl:choose>
<xsl:when test="not(edm:Annotations[@Target='microsoft.graph.authenticationEventsFlow/conditions'])">
<xsl:element name="Annotations">
<xsl:attribute name="Target">microsoft.graph.authenticationEventsFlow/conditions</xsl:attribute>
<xsl:call-template name="ReadRestrictionsTemplate">
<xsl:with-param name="readable">true</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
</xsl:choose>

</xsl:copy>
</xsl:template>
Expand Down Expand Up @@ -2106,6 +2118,19 @@
</xsl:copy>
</xsl:template>

<!-- Add readability for complex property authenticationEventsFlow/conditions -->
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']/edm:Annotations[@Target='microsoft.graph.authenticationEventsFlow/conditions']/edm:Annotation[@Term='Org.OData.Capabilities.V1.ReadRestrictions']">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:element name="Record" namespace="{namespace-uri()}">
<xsl:copy-of select="edm:Record/edm:PropertyValue"/>
<xsl:call-template name="ReadableTemplate">
<xsl:with-param name="readable">true</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:copy>
</xsl:template>

<!-- If the grand-parent "Annotations" tag already exists, modify it -->

<!-- Add readability for complex property externalUsersSelfServiceSignUpEventsFlow/onAttributeCollection -->
Expand Down Expand Up @@ -2147,6 +2172,26 @@
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<!-- Add readability for complex property authenticationEventsFlow/conditions -->
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']/edm:Annotations[@Target='microsoft.graph.authenticationEventsFlow/conditions']">
<xsl:choose>
<!--ReadRestrictions not present-->
<xsl:when test="not(edm:Annotation[@Term='Org.OData.Capabilities.V1.ReadRestrictions'])">
<xsl:copy>
<xsl:copy-of select="@*|node()"/>
<xsl:call-template name="ReadableTemplate">
<xsl:with-param name="readable">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:template>

<!-- Remove directoryObject Capability Annotations -->
<xsl:template match="edm:Schema[starts-with(@Namespace, 'microsoft.graph')]/edm:Annotations[@Target='microsoft.graph.directoryObject']/*[starts-with(@Term, 'Org.OData.Capabilities')]"/>
Expand Down
5 changes: 5 additions & 0 deletions transforms/csdl/preprocess_csdl_test_input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@
<Property Name="onAttributeCollection" Type="graph.onAttributeCollectionHandler" />
<Property Name="onAuthenticationMethodLoadStart" Type="graph.onAuthenticationMethodLoadStartHandler" />
</EntityType>
<EntityType Name="authenticationEventsFlow" BaseType="graph.entity" Abstract="true" OpenType="true">
<Property Name="conditions" Type="graph.authenticationConditions">
<Annotation Term="Org.OData.Core.V1.Description" String="The conditions representing the context of the authentication request that will be used to decide whether the events policy will be invoked." />
</Property>
</EntityType>
<ComplexType Name="onAttributeCollectionExternalUsersSelfServiceSignUp" BaseType="graph.onAttributeCollectionHandler">
<NavigationProperty Name="attributes" Type="Collection(graph.identityUserFlowAttribute)" />
</ComplexType>
Expand Down
12 changes: 12 additions & 0 deletions transforms/csdl/preprocess_csdl_test_output.xml
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,11 @@
</Annotation>
</Property>
</EntityType>
<EntityType Name="authenticationEventsFlow" BaseType="graph.entity" Abstract="true" OpenType="true">
<Property Name="conditions" Type="graph.authenticationConditions">
<Annotation Term="Org.OData.Core.V1.Description" String="The conditions representing the context of the authentication request that will be used to decide whether the events policy will be invoked." />
</Property>
</EntityType>
<ComplexType Name="onAttributeCollectionExternalUsersSelfServiceSignUp" BaseType="graph.onAttributeCollectionHandler">
<NavigationProperty Name="attributes" Type="Collection(graph.identityUserFlowAttribute)">
<Annotation Term="Org.OData.Capabilities.V1.NavigationRestrictions">
Expand Down Expand Up @@ -1366,6 +1371,13 @@
</Record>
</Annotation>
</Annotations>
<Annotations Target="microsoft.graph.authenticationEventsFlow/conditions">
<Annotation Term="Org.OData.Capabilities.V1.ReadRestrictions">
<Record>
<PropertyValue Property="Readable" Bool="true" />
</Record>
</Annotation>
</Annotations>
</Schema>
<Schema Namespace="microsoft.graph.callRecords" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<EnumType Name="callType">
Expand Down

0 comments on commit bb9eca9

Please sign in to comment.