Investigate OpenAPI discriminator support.
ref:
- https://swagger.io/specification/#discriminatorObject
- https://swagger.io/specification/#schemaObject
Discriminate based on @odata.type as the propertyName e.g. Group owners.
To support OpenType entities, we need to:
-
Add an
OpenAPIdiscriminator object on the schema that is inherited from e.g.microsoft.graph.directoryObject.
-
Ensure schemata that inherit from the base schema (
microsoft.graph.directoryObject) are present in the OpenAPI doc and have an AutoRESTx-ms-discriminator-valueextension. modified microsoft.graph.user schema.
modified microsoft.graph.group schema.

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

Reference:
- Hand modified Groups.Driectory.yml OpenAPI doc.
cc @ddyett, @irvinesunday
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.
We should also consider implementing https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/1055 once discriminator support is available in the OpenAPI files.
will likely be addressed in V3 under Kiota.