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

[Client bug]: MainError uses wrong naming for property InnerError #1916

Closed
olivermue opened this issue May 22, 2023 · 0 comments · Fixed by #1978
Closed

[Client bug]: MainError uses wrong naming for property InnerError #1916

olivermue opened this issue May 22, 2023 · 0 comments · Fixed by #1978

Comments

@olivermue
Copy link

Describe the bug
When Graph returns an error including an innerError, it won't be correctly deserialized. The problem is the naming of the property should be innerError and not innererror.

To Reproduce
An example response we got back from graph was:

{
  "error": {
    "code": "badRequest",
    "message": "Bad request.",
    "innerError": {
      "code": "invalidAssignmentState",
      "message": "Assignment in 'Assigned' state cannot be published.",
      "date": "2023-05-22T10:32:35",
      "request-id": "69d650fe-b1c1-4d9e-8f95-2551fb19d4c7",
      "client-request-id": "07b4f45c-e2eb-0392-8f94-d5d022c830ae"
    }
  }
}

But if you take a look at the code

        public IDictionary<string, Action<IParseNode>> GetFieldDeserializers() {
            return new Dictionary<string, Action<IParseNode>> {
                {"code", n => { Code = n.GetStringValue(); } },
                {"details", n => { Details = n.GetCollectionOfObjectValues<ErrorDetails>(ErrorDetails.CreateFromDiscriminatorValue)?.ToList(); } },
                {"innererror", n => { Innererror = n.GetObjectValue<Microsoft.Graph.Models.ODataErrors.InnerError>(Microsoft.Graph.Models.ODataErrors.InnerError.CreateFromDiscriminatorValue); } },
                {"message", n => { Message = n.GetStringValue(); } },
                {"target", n => { Target = n.GetStringValue(); } },
            };
        }

You'll see the wrong naming leading to the problem, that the property will return null instead of the filled instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants