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
4 changes: 4 additions & 0 deletions transforms/csdl/preprocess_csdl.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@
<!-- <xsl:template match="edm:Schema[@Namespace='microsoft.graph']/edm:Action[@Name='createUploadSession']/edm:Parameter[@Name='deferCommit']"/> -->
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']/edm:Action[@Name='createUploadSession']/edm:Parameter[@Name='deferCommit']"/>

<!-- Replace graph.report return type with Edm.Stream return type -->
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']/edm:Function[edm:ReturnType[@Type='graph.report']]/edm:ReturnType/@Type">
<xsl:attribute name="Type">Edm.Stream</xsl:attribute>
</xsl:template>

<!-- Add custom query options to calendarView navigation property -->
<xsl:template name="CalendarViewRestrictedPopertyTemplate">
Expand Down
18 changes: 17 additions & 1 deletion transforms/csdl/preprocess_csdl_test_input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,23 @@
<Parameter Name="accessPackageId" Type="Edm.String" Unicode="false" />
<Parameter Name="incompatibleAccessPackageId" Type="Edm.String" Unicode="false" />
<ReturnType Type="Collection(graph.accessPackageAssignment)" />
</Function>
</Function>
<Function Name="deviceConfigurationDeviceActivity" IsBound="true" IsComposable="true">
<Parameter Name="bindingParameter" Type="graph.reportRoot" />
<ReturnType Type="graph.report" />
</Function>
<Function Name="deviceConfigurationUserActivity" IsBound="true" IsComposable="true">
<Parameter Name="bindingParameter" Type="graph.reportRoot" />
<ReturnType Type="graph.report" />
</Function>
<Function Name="getOffice365ActivationsUserCounts" IsBound="true" IsComposable="true">
<Parameter Name="bindingParameter" Type="graph.reportRoot" />
<ReturnType Type="graph.report" Nullable="false" />
</Function>
<Function Name="getOffice365ActivationsUserDetail" IsBound="true" IsComposable="true">
<Parameter Name="bindingParameter" Type="graph.reportRoot" />
<ReturnType Type="graph.report" Nullable="false" />
</Function>
</Schema>
<Schema Namespace="microsoft.graph.callRecords" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<EnumType Name="callType">
Expand Down
16 changes: 16 additions & 0 deletions transforms/csdl/preprocess_csdl_test_output.xml
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,22 @@
<Parameter Name="incompatibleAccessPackageId" Type="Edm.String" Unicode="false" />
<ReturnType Type="Collection(graph.accessPackageAssignment)" />
</Function>
<Function Name="deviceConfigurationDeviceActivity" IsBound="true" IsComposable="true">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, can a function that returns an OData primitive (stream in this case) be composable? In my head a primitive can't have any paths expanded from it.

This would help me figure out the right way to fix the upcoming generation tomorrow as this change breaks the expectation at the link below which tries to cast the return type to a complex object.

https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator/blob/5c299f00196ef8a8ba9a0050614d3fe771963da4/src/GraphODataTemplateWriter/Extensions/OdcmModelExtensions.cs#L733

cc Vincent Biret (@baywet) Darrel (@darrelmiller) Irvine Sunday (@irvinesunday)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expansion and composition are semantically different. The former requires a complex/entity type with complex properties, the latter just another function that targets the type.
There's no reason semantically speaking why I couldn't have a "countbytes" function that binds to EDM stream. In practice I don't think I've seen bindings to primitive types however.

<Parameter Name="bindingParameter" Type="graph.reportRoot" />
<ReturnType Type="Edm.Stream" />
</Function>
<Function Name="deviceConfigurationUserActivity" IsBound="true" IsComposable="true">
<Parameter Name="bindingParameter" Type="graph.reportRoot" />
<ReturnType Type="Edm.Stream" />
</Function>
<Function Name="getOffice365ActivationsUserCounts" IsBound="true" IsComposable="true">
<Parameter Name="bindingParameter" Type="graph.reportRoot" />
<ReturnType Type="Edm.Stream" Nullable="false" />
</Function>
<Function Name="getOffice365ActivationsUserDetail" IsBound="true" IsComposable="true">
<Parameter Name="bindingParameter" Type="graph.reportRoot" />
<ReturnType Type="Edm.Stream" Nullable="false" />
</Function>
<Annotations Target="microsoft.graph.driveItem/workbook">
<Annotation Term="Org.OData.Capabilities.V1.NavigationRestrictions">
<Record>
Expand Down