microsoftgraph / msgraph-cli-archived

The Microsoft Graph CLI repository has moved. This repository is now an archive.
https://github.com/microsoftgraph/msgraph-cli
Other
44 stars 9 forks source link

CLI returns non-selected properties as null #109

Closed MIchaelMainer closed 2 years ago

MIchaelMainer commented 3 years ago

Describe the bug Selecting properties in the CLI and using the JSON return type results in a JSON array of JSON objects with the unselected properties being displayed with null values. This is incorrect as those properties may have actual values in the service. We should only return the selected properties.

At some point, the CLI is taking the response and deserializing into a model. Where a property isn't returned, it automatically sets the value to null. A client that just blindly tries to parse the JSON may make the assumption that the values have been set to null.

To Reproduce Steps to reproduce the behavior:

  1. Run mg applications application list --select "DisplayName, Appid, SignInAudience"
  2. Review the JSON objects returned. All of the non-selected properties are present and have the value null set.
[
  {
    "addIns": null,
    "additionalProperties": null,
    "api": null,
    "appId": "f31c59c3-bc6e-422f-87e0-a6d1afb157bc",
    "displayName": "Private ClientCredential",
    "signInAudience": "AzureADMyOrg",
  },
  {
    "addIns": null,
    "additionalProperties": null,
    "api": null,
    "appId": "6881477a-a153-4bf1-973e-60abfad70ad5",
    "displayName": "PublicClient",
    "signInAudience": "AzureADMyOrg",
  }
]

Expected behavior We only get back the selected properties.

[
  {
    "appId": "f31c59c3-bc6e-422f-87e0-a6d1afb157bc",
    "displayName": "Private ClientCredential",
    "signInAudience": "AzureADMyOrg",
  },
  {
    "appId": "6881477a-a153-4bf1-973e-60abfad70ad5",
    "displayName": "PublicClient",
    "signInAudience": "AzureADMyOrg",
  }
]

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

AB#9375