Description
- [x ] I have checked that the SDK documentation doesn't solve my issue.
- [ x] I have checked that the API documentation doesn't solve my issue.
- [ x] I have searched the Box Developer Forums and my issue isn't already reported (or if it has been reported, I have attached a link to it, for reference).
- [x ] I have searched Issues in this repo and my issue isn't already reported.
Description of the Issue
When using the SignRequestCreateRequest class from the Box Python SDK (box-python-sdk-gen) to create a signature request, the SDK serializes the request body incorrectly. Specifically, all fields are nested under the signers key in the resulting JSON, rather than being top-level fields as required by the Box API. This results in a 400 Bad Request error from the API, with the message that signers should be an array.
I have tried all combinations of passing signers as a positional argument, as a keyword argument, and ensuring all other fields are passed as keyword arguments, but the SDK always produces a malformed request body.
Steps to Reproduce
1/ Use the following code to attempt to create a signature request:
from box_sdk_gen.client import BoxClient
from box_sdk_gen.schemas.sign_request_create_request import SignRequestCreateRequest
from box_sdk_gen.schemas.sign_request_create_signer import SignRequestCreateSigner
from box_sdk_gen.schemas.folder_mini import FolderMini
client = BoxClient(...) # Authenticated client
signers = [SignRequestCreateSigner(email="signer@example.com", role="signer")]
parent_folder = FolderMini(id="123456789", type="folder")
request = SignRequestCreateRequest(
signers, # positional argument
parent_folder=parent_folder,
is_document_preparation_needed=False,
redirect_url="https://app.box.com",
template_id="template-id-here"
)
client.sign_requests.create_sign_request(request)
2/ Observe the request body sent to the API (via logs or by capturing the HTTP request):
{
"signers": {
"is_document_preparation_needed": false,
"redirect_url": "https://app.box.com",
"template_id": "template-id-here",
"signers": [
{
"email": "signer@example.com",
"role": "signer"
}
],
"parent_folder": {
"id": "123456789",
"type": "folder"
}
}
}
3/ The API responds with a 400 Bad Request error, stating that signers should be an array.
Expected Behavior
The SDK should serialize the request so that all fields are top-level, matching the API documentation and what works in Postman:
{
"signers": [
{
"email": "signer@example.com",
"role": "signer"
}
],
"template_id": "template-id-here",
"parent_folder": {
"id": "123456789",
"type": "folder"
},
"is_document_preparation_needed": false,
"redirect_url": "https://app.box.com"
}
Error Message, Including Stack Trace
400 Bad request; Request ID:
Body: {"type":"error","code":"bad_request","status":400,"message":"Bad request","help_url":"https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/","request_id":"","context_info":{"errors":[{"name":"signers","message":"should be array (Schema path: #/allOf/1/properties/signers/type; Data path: .signers)","reason":"invalid_parameter"}]}}
SDK Serializes the Request as:
{
"signers": {
"is_document_preparation_needed": false,
"redirect_url": "https://app.box.com",
"template_id": "template-id-here",
"signers": [
{
"email": "signer@example.com",
"role": "signer"
}
],
"parent_folder": {
"id": "123456789",
"type": "folder"
}
}
}
Versions Used
Python SDK: box-python-sdk-gen 1.13.0
Python: 3.13.0