Calling toPatchInformation prior to calling patch causes patch to silently fail
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start at the Application request entry points toPatchRequestInformation and patch, then compare their repeated setContentFromParsable calls and any request state they share. Reproduce the two sequences from the issue and add a regression test showing that calling toPatchRequestInformation first does not prevent patch from updating the application.
Written by the indexing model from the issue text.
Description
Describe the bug
When calling a patch operation on an Application request, calling toPatchInformation causes the .patch(app) to not work. If true, then this probably needs either a doc update or a fix.
This does not work, but no error is thrown and the logs are clean it seems:
// DOES NOT WORK
val trequest = graphClient.applications().byApplicationId(oid)
val emptyApp = Application()
emptyApp.setNotes(s"Updated via code. ${java.time.ZonedDateTime.now()}")
trequest.toPatchRequestInformation(emptyApp)
trequest.patch(emptyApp)
but this works and the application registration is changed
// WORKS
val trequest = graphClient.applications().byApplicationId(oid)
val emptyApp = Application()
emptyApp.setNotes(s"Updated via code. ${java.time.ZonedDateTime.now()}")
//trequest.toPatchRequestInformation(emptyApp)
trequest.patch(emptyApp)
This may be related to something not idempotent and there is some hidden state somewhere.
OTEL logging suggest that the only difference in calling is that the following is called twice when including the toPatchRequestInformation prior to patch. patch also calls toPatchRequestInformation as well. However,
it looks like creating RequestInformation is idempotent...hmm...
// this is the only difference in the trace which is expected since setContentFromParsable is called when toPatchRequestInformation is called.
[otel.javaagent 2025-02-09 16:38:49:625 -0500] [main] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'setContentFromParsable' : ace455a22586ba518b85e4a1b307630d b731da65e1939a46 INTERNAL [tracer: com.microsoft.kiota:] AttributesMap{data={thread.id=1, com.microsoft.kiota.request.type=com.microsoft.graph.models.Application, thread.name=main}, capacity=128, totalAddedValues=3}
[otel.javaagent 2025-02-09 16:38:49:625 -0500] [main] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'setContentFromParsable' : 9e931b04f0305f0ef5df1bb3a8b59f78 30a5455e58f3fb17 INTERNAL [tracer: com.microsoft.kiota:] AttributesMap{data={thread.id=1, com.microsoft.kiota.request.type=com.microsoft.graph.models.Application, thread.name=main}, capacity=128, totalAddedValues=3}
Expected behavior
The patch works even if toPatchRequestInformation is called prior to calling patch.
How to reproduce
SDK Version
6.x, latest
Latest version known to work for scenario above?
No response
Known Workarounds
None
Debug output
Click to expand log
```</details>
### Configuration
_No response_
### Other information
_No response_
- Dominant language
- Java
- Stars
- 444
- Forks
- 154
- Avg merge
- 18h 28m
- Merged PRs (30d)
- 4
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.
More from microsoftgraph/msgraph-sdk-java
-
status:waiting-for-triage type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
microsoftgraph/msgraph-sdk-java#2610 ·
-
status:waiting-for-triage type:bug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
microsoftgraph/msgraph-sdk-java#2656 ·
-
status:waiting-for-triage type:bug
Difficulty 4/5 3-5 days Newbie friendliness 38/100
microsoftgraph/msgraph-sdk-java#2654 ·
-
status:waiting-for-triage
Difficulty 4/5 3-5 days Newbie friendliness 35/100
microsoftgraph/msgraph-sdk-java#2639 ·
-
status:waiting-for-triage type:bug
Difficulty 3/5 1-2 days Newbie friendliness 35/100
microsoftgraph/msgraph-sdk-java#2589 · 1 comment ·
All issues in microsoftgraph/msgraph-sdk-java
Similar issues
-
certification
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's Openbug ecr
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Needs: Triage Type: Feature request
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
github/copilot-sdk#2760 ·