microsoft.graph.onPremisesPublishing wrong serialization
還沒有人認領這個 Issue。
評估
研究方向
從產生的 Application 和 OnPremisesPublishing 模型,以及重現中使用的 JsonSerializationWriter 開始。執行提供的序列化範例,並將其 onPremisesPublishing 輸出與 additional_data 變通方案進行比較。當 SDK 發出的 JSON 能被後端接受,且修補程式要求不再傳回 InvalidJson_BadRequest 時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
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
- 主要語言
- Python
- 星號
- 630
- 分支
- 96
- 平均合併
- 15 小時 20 分鐘
- 30 天內合併 PR
- 3
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoftgraph/msgraph-sdk-python 的其他 Issue
-
status:waiting-for-triage type:bug
難度 1/5 1 小時以內 新手友好度 90/100
microsoftgraph/msgraph-sdk-python#1570 ·
-
status:waiting-for-triage type:bug
難度 2/5 1-3 小時 新手友好度 75/100
microsoftgraph/msgraph-sdk-python#1563 ·
-
Needs: Attention :wave: type:bug
難度 2/5 1-3 小時 新手友好度 62/100
microsoftgraph/msgraph-sdk-python#1287 · 2 則留言 · 1 個 reaction ·
-
status:waiting-for-triage
難度 5/5 一週以上 新手友好度 25/100
microsoftgraph/msgraph-sdk-python#1557 ·
-
status:waiting-for-triage type:bug
難度 3/5 1-2 天 新手友好度 55/100
microsoftgraph/msgraph-sdk-python#1556 · 1 則留言 · 1 個 reaction ·
查看 microsoftgraph/msgraph-sdk-python 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 86/100
zostera/django-bootstrap4#894 ·
-
難度 2/5 1-3 小時 新手友好度 78/100
use-agent-os/agent-os#3276 ·
-
難度 2/5 1-3 小時 新手友好度 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
難度 2/5 1-3 小時 新手友好度 88/100
NousResearch/hermes-agent#117848 ·
-
難度 2/5 1-3 小時 新手友好度 82/100
zilliztech/memsearch#759 ·