Skip to content

Commit 4922d59

Browse files
fix: correct SignerMetadata and Notify contracts to match runtime shape
SignRequest.getMetadata() stores notify history as array<{date: int, method: string}> entries. The previous SignerMetadata union type caused swagger-test to attempt DynamicMetadataValue scalar validation on the notify array, producing 'Array to string conversion' PHP warnings in FileControllerTest (6× matchNumber, 3× matchBool per test run). Changes: - LibresignNotify.date: string -> non-negative-int (runtime stores Unix timestamp via time()) - LibresignNotify: add optional description field (stored when SignRequest has description) - LibresignSignerMetadata: add notify?: LibresignNotify[] to known-fields branch - LibresignSignerMetadata: remove |array<string, DynamicMetadataValue> fallback (all actual keys are now covered by the known-fields branch) Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 91cfb98 commit 4922d59

5 files changed

Lines changed: 54 additions & 48 deletions

File tree

lib/ResponseDefinitions.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@
132132
* }
133133
* @psalm-type LibresignIdentifyAccountsResponse = list<LibresignIdentifyAccount>
134134
* @psalm-type LibresignNotify = array{
135-
* date: string,
135+
* date: non-negative-int,
136136
* method: "activity"|"notify"|"mail",
137+
* description?: string,
137138
* }
138139
* @psalm-type LibresignRequestedBy = array{
139140
* userId: string,
@@ -151,8 +152,9 @@
151152
* @psalm-type LibresignSignerMetadata = array{
152153
* remote-address?: string,
153154
* user-agent?: string,
155+
* notify?: LibresignNotify[],
154156
* certificate_info?: LibresignSignerCertificateInfo,
155-
* }|array<string, LibresignDynamicMetadataValue>
157+
* }
156158
* @psalm-type LibresignSignerSummary = array{
157159
* signRequestId: int,
158160
* displayName: string,

openapi-full.json

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,7 +1840,9 @@
18401840
],
18411841
"properties": {
18421842
"date": {
1843-
"type": "string"
1843+
"type": "integer",
1844+
"format": "int64",
1845+
"minimum": 0
18441846
},
18451847
"method": {
18461848
"type": "string",
@@ -1849,6 +1851,9 @@
18491851
"notify",
18501852
"mail"
18511853
]
1854+
},
1855+
"description": {
1856+
"type": "string"
18521857
}
18531858
}
18541859
},
@@ -2514,28 +2519,24 @@
25142519
]
25152520
},
25162521
"SignerMetadata": {
2517-
"anyOf": [
2518-
{
2519-
"type": "object",
2520-
"properties": {
2521-
"remote-address": {
2522-
"type": "string"
2523-
},
2524-
"user-agent": {
2525-
"type": "string"
2526-
},
2527-
"certificate_info": {
2528-
"$ref": "#/components/schemas/SignerCertificateInfo"
2529-
}
2530-
}
2522+
"type": "object",
2523+
"properties": {
2524+
"remote-address": {
2525+
"type": "string"
25312526
},
2532-
{
2533-
"type": "object",
2534-
"additionalProperties": {
2535-
"$ref": "#/components/schemas/DynamicMetadataValue"
2527+
"user-agent": {
2528+
"type": "string"
2529+
},
2530+
"notify": {
2531+
"type": "array",
2532+
"items": {
2533+
"$ref": "#/components/schemas/Notify"
25362534
}
2535+
},
2536+
"certificate_info": {
2537+
"$ref": "#/components/schemas/SignerCertificateInfo"
25372538
}
2538-
]
2539+
}
25392540
},
25402541
"SignerSummary": {
25412542
"type": "object",

openapi.json

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,9 @@
13791379
],
13801380
"properties": {
13811381
"date": {
1382-
"type": "string"
1382+
"type": "integer",
1383+
"format": "int64",
1384+
"minimum": 0
13831385
},
13841386
"method": {
13851387
"type": "string",
@@ -1388,6 +1390,9 @@
13881390
"notify",
13891391
"mail"
13901392
]
1393+
},
1394+
"description": {
1395+
"type": "string"
13911396
}
13921397
}
13931398
},
@@ -1916,28 +1921,24 @@
19161921
]
19171922
},
19181923
"SignerMetadata": {
1919-
"anyOf": [
1920-
{
1921-
"type": "object",
1922-
"properties": {
1923-
"remote-address": {
1924-
"type": "string"
1925-
},
1926-
"user-agent": {
1927-
"type": "string"
1928-
},
1929-
"certificate_info": {
1930-
"$ref": "#/components/schemas/SignerCertificateInfo"
1931-
}
1932-
}
1924+
"type": "object",
1925+
"properties": {
1926+
"remote-address": {
1927+
"type": "string"
19331928
},
1934-
{
1935-
"type": "object",
1936-
"additionalProperties": {
1937-
"$ref": "#/components/schemas/DynamicMetadataValue"
1929+
"user-agent": {
1930+
"type": "string"
1931+
},
1932+
"notify": {
1933+
"type": "array",
1934+
"items": {
1935+
"$ref": "#/components/schemas/Notify"
19381936
}
1937+
},
1938+
"certificate_info": {
1939+
"$ref": "#/components/schemas/SignerCertificateInfo"
19391940
}
1940-
]
1941+
}
19411942
},
19421943
"SignerSummary": {
19431944
"type": "object",

src/types/openapi/openapi-full.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,9 +2018,11 @@ export type components = {
20182018
status?: number;
20192019
};
20202020
Notify: {
2021-
date: string;
2021+
/** Format: int64 */
2022+
date: number;
20222023
/** @enum {string} */
20232024
method: "activity" | "notify" | "mail";
2025+
description?: string;
20242026
};
20252027
OCSMeta: {
20262028
status: string;
@@ -2222,9 +2224,8 @@ export type components = {
22222224
SignerMetadata: {
22232225
"remote-address"?: string;
22242226
"user-agent"?: string;
2227+
notify?: components["schemas"]["Notify"][];
22252228
certificate_info?: components["schemas"]["SignerCertificateInfo"];
2226-
} | {
2227-
[key: string]: components["schemas"]["DynamicMetadataValue"];
22282229
};
22292230
SignerSummary: {
22302231
/** Format: int64 */

src/types/openapi/openapi.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,9 +1414,11 @@ export type components = {
14141414
status?: number;
14151415
};
14161416
Notify: {
1417-
date: string;
1417+
/** Format: int64 */
1418+
date: number;
14181419
/** @enum {string} */
14191420
method: "activity" | "notify" | "mail";
1421+
description?: string;
14201422
};
14211423
OCSMeta: {
14221424
status: string;
@@ -1577,9 +1579,8 @@ export type components = {
15771579
SignerMetadata: {
15781580
"remote-address"?: string;
15791581
"user-agent"?: string;
1582+
notify?: components["schemas"]["Notify"][];
15801583
certificate_info?: components["schemas"]["SignerCertificateInfo"];
1581-
} | {
1582-
[key: string]: components["schemas"]["DynamicMetadataValue"];
15831584
};
15841585
SignerSummary: {
15851586
/** Format: int64 */

0 commit comments

Comments
 (0)