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

Incorrect type for "Identity" in "IdentitySet" #116

Open
arthur-caillaud opened this issue Feb 3, 2020 · 12 comments
Open

Incorrect type for "Identity" in "IdentitySet" #116

arthur-caillaud opened this issue Feb 3, 2020 · 12 comments
Labels
ADO to GitHub automation label Issue caused by core project dependency modules or library service issue status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close

Comments

@arthur-caillaud
Copy link

arthur-caillaud commented Feb 3, 2020

The type Identity seems to be different from what the API is returning. This error occured for us when retrieving the identity of the creator of the document using the createdBy.user field on a DriveItem.

Expected (declared in microsoft-graph.d.ts line 8736)

{
  id?: string;
  displayName?: string;
}

Returned by API

{
  email: "some.email@domain",
  displayName: "Some Name"
}

We tried to switch to the beta types but they are the same.

We are for now casting the createdBy.user property to what the API is returning.
AB#7046

@ghost ghost added the ToTriage label Feb 3, 2020
@ghost ghost added this to Issues to triage in Graph SDK - Triage Feb 3, 2020
@MIchaelMainer
Copy link
Contributor

This is expected behavior per the metadata. This is an OpenType which means that undefined properties may be returned in this object. Additionally, id and displayName are nullable so it is expected that they may not be present in a response.

      <ComplexType Name="identity" OpenType="true">
        <Property Name="displayName" Type="Edm.String" />
        <Property Name="id" Type="Edm.String" />
      </ComplexType>

@ificator and @BarryShehadeh It seems like the email property should be schematized.

@arthur-caillaud
Copy link
Author

Thank you for your answer. I was not clear but the issue is precisely about the email property being absent in the types and returned by the API. No problem with some properties being optional.

@MIchaelMainer MIchaelMainer removed this from Issues to triage in Graph SDK - Triage Feb 27, 2020
@mpsijm
Copy link
Contributor

mpsijm commented Oct 26, 2020

I also ran into this issue. Any updates on this?

@ificator
Copy link

I apologize, I somehow missed the previous notification from GitHub.

So there are two questions:

  1. Why is id missing?
  2. Why is email a dynamic property instead of being present in the schema?

For the former it will be useful to understand the scenario - was this a call against SharePoint or OneDrive Personal? what API was being invoked?

For the latter - off the top of my head I don't see why this cannot be the case. There will be times when there is no email (e.g. if the identity represents a device) and so the value would be nullable but from that's essentially no different to todays state.

@mpsijm
Copy link
Contributor

mpsijm commented Oct 26, 2020

  1. In my context, I'm using a SharePoint API. The exact same user sometimes has an id, sometimes doesn't. The email property from that same user seems to be there most of the time, but not always. See also the scenario I posted here: https://github.com/microsoftgraph/microsoft-graph-docs-contrib/issues/4363.

  2. In the case that the identity represents a device, it would also make sense to me that the email is nullable. However, (a) it is currently not documented (neither in the typings nor in the docs) and (b) it seems to be not consistently set for regular users as in my previous point.

@ificator
Copy link

Any kind of inconsistency should be viewed as a bug so we'll investigate what's going on with the delta API. Are there any other APIs that you've noticed missing id values?

@mpsijm
Copy link
Contributor

mpsijm commented Nov 1, 2020

Not that I know of, at the moment. Is there a better place to report those inconsistencies than the typings or docs repositories? Then I can report back there if I can consistently reproduce missing values using the Graph Explorer.

@ificator
Copy link

ificator commented Nov 1, 2020

For OneDrive / SharePoint API issues / questions the best place is https://github.com/OneDrive/OneDrive-api-docs. We generally only spot issues other repos when we're explicitly tagged.

@ificator
Copy link

Hi @mpsijm we recently pushed a change that should result in delta populating the id for identity objects that represent a user/group. Could you confirm that things are looking more consistent for you now?

@mpsijm
Copy link
Contributor

mpsijm commented Nov 27, 2020

@ificator Yes, on first sight it looks like it's been fixed, thanks 😄 Still need to some more thorough testing, if I find anything weird I'll report back 🙂

The email field now also seems to show up consistently in the response data (if the user has an email, of course), even though that field is still undocumented (see my second point in #116 (comment)).

@ddyett ddyett added the ADO to GitHub automation label Issue caused by core project dependency modules or library label Jan 11, 2021
@aigolang
Copy link

aigolang commented Mar 13, 2023

Hello @mpsijm , could you please tell me how do you make the email and id of a user showing up consistently in the response CreatedBy filed.
MS Graph API is GET /drives/{drive-id}/items/{item-id}
For some users, the email and id are missing in the response.

https://learn.microsoft.com/en-us/graph/api/resources/identity?view=graph-rest-1.0
In some circumstances, the unique identifier for the actor might not be available. In this case, the displayName property for the identity will be returned, but the id property will be missing from the resource.
What is the circumstance?

@mpsijm
Copy link
Contributor

mpsijm commented Mar 13, 2023

@aigolang I did not do anything specific for this. The change in the API from #116 (comment) appeared to have fixed things, and we did not run into any issues since then. I still do not know under what circumstances some fields may be empty 😅

@fey101 fey101 added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Needs: Author Feedback labels May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADO to GitHub automation label Issue caused by core project dependency modules or library service issue status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close
Projects
No open projects
Graph Service issues
Awaiting triage
Development

No branches or pull requests

7 participants