microsoftgraph / microsoftgraph/msgraph-beta-sdk-java
Permissions error response not deserialized correctly
Open
Nobody has claimed this yet.
Needs: attention :wave:
question
- Dominant language
- Java
- Stars
- 32
- Forks
- 14
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 6
Description
Expected behavior
API calls with errors should return a useable error response.
Actual behavior
An exception is thrown while parsing the permission error response:
com.microsoft.graph.beta.models.odataerrors.ODataError:
at com.microsoft.graph.beta.models.odataerrors.ODataError.createFromDiscriminatorValue(ODataError.java:36) ~[microsoft-graph-beta-6.5.1.jar:na]
at com.microsoft.kiota.serialization.JsonParseNode.getObjectValue(JsonParseNode.java:211) ~[microsoft-kiota-serialization-json-1.1.2.jar:na]
at com.microsoft.kiota.http.OkHttpRequestAdapter.lambda$throwIfFailedResponse$0(OkHttpRequestAdapter.java:674) ~[microsoft-kiota-http-okHttp-1.1.2.jar:na]
at com.microsoft.kiota.ApiExceptionBuilder.<init>(ApiExceptionBuilder.java:26) ~[microsoft-kiota-abstractions-1.1.2.jar:na]
at com.microsoft.kiota.http.OkHttpRequestAdapter.throwIfFailedResponse(OkHttpRequestAdapter.java:673) ~[microsoft-kiota-http-okHttp-1.1.2.jar:na]
at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:281) ~[microsoft-kiota-http-okHttp-1.1.2.jar:na]
at com.microsoft.graph.beta.security.informationprotection.sensitivitylabels.SensitivityLabelsRequestBuilder.get(SensitivityLabelsRequestBuilder.java:120) ~[microsoft-graph-beta-6.5.1.jar:na]
Steps to reproduce the behavior
- Use any sdk versions 6.3.0 to 6.5.1
- Using client secret credentials, call a graph api which requires a permission that app registration client does not have
- Observe the thrown exception as shown above
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with client-secret credentials and an API call missing the required permission. Start with ODataError.createFromDiscriminatorValue, JsonParseNode.getObjectValue, and OkHttpRequestAdapter.throwIfFailedResponse from the stack trace; done means the permission error response is deserialized into a usable error without the parsing exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, authorization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100