microsoftgraph / microsoftgraph/msgraph-sdk-python
microsoft.graph.onPremisesPublishing wrong serialization
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 630
- Fork
- 96
- Merge trung bình
- 15 giờ 20 phút
- Pull request đã merge (30 ngày)
- 3
Mô tả
Describe the bug
Same bug as in the PHP SDK from 2025
https://github.com/microsoftgraph/msgraph-beta-sdk-php/issues/356
from msgraph_beta import GraphServiceClient as BetaClient
from msgraph_beta.generated.models.application import Application as Application
from msgraph_beta.generated.models.on_premises_publishing import OnPremisesPublishing
from msgraph_beta.generated.models.external_authentication_type import ExternalAuthenticationType
request_body = Application(
on_premises_publishing = OnPremisesPublishing(
external_authentication_type=ExternalAuthenticationType.Passthru,
internal_url="http://localhost:65001",
external_url="https://whatever",
is_http_only_cookie_enabled=False,
is_on_prem_publishing_enabled=True,
is_persistent_cookie_enabled=False,
is_secure_cookie_enabled=False,
is_state_session_enabled=False,
is_translate_host_header_enabled=False,
is_translate_links_in_body_enabled=False,
is_backend_certificate_validation_enabled=False
),
)
from kiota_serialization_json.json_serialization_writer import JsonSerializationWriter
writer = JsonSerializationWriter()
request_body.serialize(writer)
print(writer.get_serialized_content().decode('utf-8'))
Output:
{"@odata.type": "#microsoft.graph.application", "onPremisesPublishing": {"externalAuthenticationType": "passthru", "externalUrl": "https://whatever", "internalUrl": "http://localhost:65001", "isBackendCertificateValidationEnabled": false, "isHttpOnlyCookieEnabled": false, "isOnPremPublishingEnabled": true, "isPersistentCookieEnabled": false, "isSecureCookieEnabled": false, "isStateSessionEnabled": false, "isTranslateHostHeaderEnabled": false, "isTranslateLinksInBodyEnabled": false}}
await beta_client.applications.by_application_id(app.application.id).patch(request_body) then fails with
APIError
Code: 400
message: None
error: MainError(additional_data={}, code='InvalidJson_BadRequest', details=None, inner_error=InnerError(additional_data={}, client_request_id='xxxx', date=datetime.datetime(2026, 7, 10, 8, 49, 27), odata_type=None, request_id='xxxx'), message='Valid JSON content expected.', target=None)
Expected behavior
proper error message and properly serialized data sent to the backend
How to reproduce
see above
SDK Version
1.59.0
Latest version known to work for scenario above?
No response
Known Workarounds
request_body = BetaApplication(
additional_data = {
"microsoft.graph.onPremisesPublishing": {
"@odata.type": "#microsoft.graph.onPremisesPublishing",
"externalAuthenticationType": "passthru",
"internalUrl": "http://localhost:65001",
"externalUrl": EXTERNAL_URL,
"isHttpOnlyCookieEnabled": False,
"isOnPremPublishingEnabled": True,
"isPersistentCookieEnabled": False,
"isSecureCookieEnabled": False,
"isStateSessionEnabled": False,
"isTranslateHostHeaderEnabled": False,
"isTranslateLinksInBodyEnabled": False,
"isBackendCertificateValidationEnabled": False
}
}
)
Debug output
No response
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 với các model Application và OnPremisesPublishing được tạo ra cùng với JsonSerializationWriter được sử dụng trong bản tái hiện. Chạy ví dụ serialization được cung cấp và so sánh output onPremisesPublishing của nó với workaround additional_data. Hoàn tất khi SDK phát ra JSON được backend chấp nhận và patch request không còn trả về InvalidJson_BadRequest.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 52/100