microsoftgraph / msgraph-sdk-powershell

Powershell SDK for Microsoft Graph
https://www.powershellgallery.com/packages/Microsoft.Graph
Other
693 stars 167 forks source link

Investigate OpenAPI discriminator support. #19

Open peombwa opened 5 years ago

peombwa commented 5 years ago

ref:

AB#4988

peombwa commented 4 years ago

Discriminate based on @odata.type as the propertyName e.g. Group owners.

peombwa commented 4 years ago

To support OpenType entities, we need to:

  1. Add an OpenAPI discriminator object on the schema that is inherited from e.g. microsoft.graph.directoryObject. image

  2. Ensure schemata that inherit from the base schema (microsoft.graph.directoryObject) are present in the OpenAPI doc and have an AutoREST x-ms-discriminator-value extension. modified microsoft.graph.user schema. image modified microsoft.graph.group schema. image

This generates a polymorphic type that returns appropriate types based on @odata.type. image

Reference:

cc @ddyett, @irvinesunday

darrelmiller commented 4 years ago

We need to find out what is the capability annotation that can describe the set of derived types that are returned from a navigation property that points to a collection of baseType.

peombwa commented 2 years ago

We should also consider implementing https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/1055 once discriminator support is available in the OpenAPI files.

ddyett commented 2 years ago

will likely be addressed in V3 under Kiota.