Skip to content

Commit 04011b3

Browse files
Update the response schema to return just the custom field that got updated instead of the array
1 parent 31f20cc commit 04011b3

File tree

2 files changed

+30
-25
lines changed

2 files changed

+30
-25
lines changed

certified-connectors/DocuSignDemo/apiDefinition.swagger.json

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3493,29 +3493,6 @@
34933493
}
34943494
},
34953495
"UpdateEnvelopeCustomFieldResponse": {
3496-
"type": "object",
3497-
"properties": {
3498-
"textCustomFields": {
3499-
"description": "The text envelope custom fields.",
3500-
"type": "array",
3501-
"items": {
3502-
"$ref": "#/definitions/EnvelopeCustomField"
3503-
},
3504-
"x-ms-summary": "Text envelope custom fields",
3505-
"x-ms-visibility": "important"
3506-
},
3507-
"listCustomFields": {
3508-
"description": "The list envelope custom fields.",
3509-
"type": "array",
3510-
"items": {
3511-
"$ref": "#/definitions/EnvelopeCustomField"
3512-
},
3513-
"x-ms-summary": "List envelope custom fields",
3514-
"x-ms-visibility": "important"
3515-
}
3516-
}
3517-
},
3518-
"EnvelopeCustomField": {
35193496
"type": "object",
35203497
"properties": {
35213498
"fieldId": {
@@ -3524,6 +3501,12 @@
35243501
"x-ms-summary": "Field ID",
35253502
"x-ms-visibility": "important"
35263503
},
3504+
"fieldType": {
3505+
"description": "The type of the envelope custom field.",
3506+
"type": "string",
3507+
"x-ms-summary": "Field Type",
3508+
"x-ms-visibility": "important"
3509+
},
35273510
"name": {
35283511
"description": "The name of the envelope custom field.",
35293512
"type": "string",
@@ -3535,9 +3518,9 @@
35353518
"type": "string",
35363519
"x-ms-summary": "Value",
35373520
"x-ms-visibility": "important"
3538-
}
3521+
}
35393522
}
3540-
},
3523+
},
35413524
"Folder": {
35423525
"type": "object",
35433526
"properties": {

certified-connectors/DocuSignDemo/script.csx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,28 @@ public class Script : ScriptBase
17461746
response.Content = new StringContent(responseCustomField.ToString(), Encoding.UTF8, "application/json");
17471747
}
17481748

1749+
if ("UpdateEnvelopeCustomField".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
1750+
{
1751+
var body = ParseContentAsJObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), false);
1752+
var responseCustomField = new JObject();
1753+
1754+
foreach (var customField in (body["textCustomFields"] as JArray) ?? new JArray())
1755+
{
1756+
responseCustomField = customField as JObject;
1757+
responseCustomField["fieldType"] = "Text";
1758+
break;
1759+
}
1760+
1761+
foreach (var customField in (body["listCustomFields"] as JArray) ?? new JArray())
1762+
{
1763+
responseCustomField = customField as JObject;
1764+
responseCustomField["fieldType"] = "List";
1765+
break;
1766+
}
1767+
1768+
response.Content = new StringContent(responseCustomField.ToString(), Encoding.UTF8, "application/json");
1769+
}
1770+
17491771
if ("AddRecipientToEnvelopeV2".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
17501772
{
17511773
var body = ParseContentAsJObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), false);

0 commit comments

Comments
 (0)