Add x-ms-discriminator support to OpenAPI for PowerShell
https://github.com/Azure/autorest/blob/master/docs/extensions/readme.md#x-ms-discriminator-value Should this go in OData.OpenApi reader? Or in OpenAPI.NET v3 -> v2 translation.
Related to: https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/19#
Add support for x-ms-discriminator here https://github.com/microsoft/OpenAPI.NET/blob/vnext/src/Microsoft.OpenApi/Models/OpenApiDiscriminator.cs#L49
In order to identify derived types we will need to replace all $refs to base types with the following:
oneOf:
- $ref: '#/components/schemas/microsoft.graph.directoryObject'
- $ref: '#/components/schemas/microsoft.graph.user'
- $ref: '#/components/schemas/microsoft.graph.group'
More details are explained here https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/19
@peombwa Is the oneOf essential for enabling discriminators or is it just a nice to have?
@darrelmiller It is not essential. We can enable it by having the discriminator object on the base type and x-ms-discriminator-value on the derived type. Since the value of the OData.Type starts with a #, we need to have x-ms-discriminator-value on the derived type with its OData.Type value. e.g. #microsoft.graph.user.
Reopening this so we can investigate the feasibility of using the DerivedTypeConstraint that was added to in https://github.com/microsoftgraph/msgraph-metadata/pull/33 to pull in all the derived types of a base type.
@peombwa do we still need this?
Yes, we do @adhiambovivian . We need this to be supported so we can have discriminator support in PS SDK.