Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5 preview does not create objects based on discriminator value #477

Closed
MarkusBux opened this issue Jun 21, 2022 · 2 comments · Fixed by #493
Closed

v5 preview does not create objects based on discriminator value #477

MarkusBux opened this issue Jun 21, 2022 · 2 comments · Fixed by #493
Assignees
Labels
Bug Something isn't working fixed OpenApi

Comments

@MarkusBux
Copy link

Querying the DeviceAppManagement.MobileApps will result in only MobileApp objects.

using the following code snippet every app is returned as MobileApp regardless of the discriminator.

var response = await graphServiceClient
    .DeviceAppManagement
    .MobileApps
    .GetAsync(r =>
        {
            r.QueryParameters.Filter = "(microsoft.graph.managedApp/appAvailability eq null or microsoft.graph.managedApp/appAvailability eq 'lineOfBusiness' or isAssigned eq true)";
            r.QueryParameters.Select = new[] { "id", "displayName", "microsoft.graph.managedApp/appAvailability" };
        },
        cancellationToken: cancellationToken);

var types = response
    .Value
    .GroupBy(t => t.GetType());

image

The MobileApp.CreateFromDiscriminatorValue (IParseNode arseNode) does not include the mentioned value.
image

Is this expected behavior or how can I manually convert this objects to the correct type?

@ghost ghost added the Needs: Triage label Jun 21, 2022
@andrueastman
Copy link
Member

Thanks for raising this @MarkusBux.

This looks to be an issue with the discriminator missing some types in the list and we are looking to fix this in the OpenApi converter via microsoft/OpenAPI.NET.OData#240

@andrueastman andrueastman self-assigned this Jun 27, 2022
@andrueastman andrueastman added the Bug Something isn't working label Jun 27, 2022
@andrueastman andrueastman linked a pull request Jul 20, 2022 that will close this issue
1 task
@andrueastman
Copy link
Member

Closing this one for now.

The missing entries have been updated via #493 and available through the latest 5.10.0-preview package.

"#microsoft.graph.windowsMobileMSI" => new WindowsMobileMSI(),

@ghost ghost locked as resolved and limited conversation to collaborators Aug 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working fixed OpenApi
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants