microsoftgraph / microsoftgraph/msgraph-sdk-java
Calling toPatchInformation prior to calling patch causes patch to silently fail
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 444
- Fork
- 154
- Merge trung bình
- 18 giờ 28 phút
- Pull request đã merge (30 ngày)
- 4
Mô tả
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_
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu từ các điểm vào request của Application là toPatchRequestInformation và patch, sau đó so sánh các lần gọi lặp lại setContentFromParsable của chúng và mọi trạng thái request mà chúng dùng chung. Tái hiện hai chuỗi từ issue và thêm một regression test cho thấy việc gọi toPatchRequestInformation trước không ngăn patch cập nhật Application.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100