microsoftgraph / msgraph-metadata

Microsoft Graph metadata captured and used for generating client library code files.
https://graph.microsoft.com
MIT License
105 stars 33 forks source link

`Restore` Action Should Only Be Bound On `directory/deletedItems` #169

Open peombwa opened 2 years ago

peombwa commented 2 years ago

Restore action bound on directoryObject should only be applied to directory/deletedItems/{id} and not the derived types of directoryObject. See https://docs.microsoft.com/en-us/graph/api/directory-deleteditems-restore?view=graph-rest-1.0&tabs=http.

We currently don't have an OData capability annotation that we can use to restrict how OData actions and functions are bound.

The lack of this restriction results in a broken experience for customers using our SDKs since the generated actions bound on the derived types fail with a status code of 400.

Current representation in the CSDL

<Action Name="restore" IsBound="true">
  <Parameter Name="bindingParameter" Type="graph.directoryObject" Nullable="false" />
  <ReturnType Type="graph.directoryObject" />
</Action>
peombwa commented 1 year ago

A similar issue also affects grant action that's bound to permission. Grant action is only valid for POST /shares/{encoded-sharing-url}/permission/grant.

<Action Name="grant" IsBound="true">
  <Parameter Name="bindingParameter" Type="graph.permission" />
  <Parameter Name="roles" Type="Collection(Edm.String)" Unicode="false" />
  <Parameter Name="recipients" Type="Collection(graph.driveRecipient)" />
  <ReturnType Type="Collection(graph. Permission)" />
</Action>

As per an internal discussion, we will add a new annotation to signal that an action or function must be explicitly bound (listed target types). See https://github.com/microsoft/OpenAPI.NET.OData/issues/232#issuecomment-1299721103

peombwa commented 1 year ago

add action on conversationMember seems to be only valid for POST /teams/{team-id}/members/add.

<Action Name="add" IsBound="true">
  <Parameter Name="bindingParameter" Type="Collection(graph.conversationMember)" />
  <Parameter Name="values" Type="Collection(graph.conversationMember)" />
  <ReturnType Type="Collection(graph.actionResultPart)" />
</Action>

See related issue - https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/1494.