Skip to content

Commit 5705a0e

Browse files
authored
Merge pull request #7656 from LibreSign/fix/openapi-runtime-metadata-impacts
fix: align OpenAPI file metadata contract with runtime payloads
2 parents 4875bd5 + 13711de commit 5705a0e

5 files changed

Lines changed: 84 additions & 45 deletions

File tree

lib/ResponseDefinitions.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@
363363
* pdfVersion?: string,
364364
* status_changed_at?: string,
365365
* }
366+
* @psalm-type LibresignFileRuntimeMetadata = LibresignValidateMetadata|array<string, mixed>
366367
* @psalm-type LibresignValidationPageResolution = array{
367368
* w: float,
368369
* h: float,
@@ -465,11 +466,11 @@
465466
* statusText: string,
466467
* nodeType: 'file'|'envelope',
467468
* created_at: string,
468-
* metadata: LibresignValidateMetadata,
469+
* metadata: LibresignFileRuntimeMetadata,
469470
* docmdpLevel: int,
470471
* signatureFlow: 'none'|'parallel'|'ordered_numeric',
471472
* signersCount: int,
472-
* signers: list<empty>,
473+
* signers: list<LibresignSignerSummary>,
473474
* requested_by: LibresignRequestedBy,
474475
* filesCount: int<0, max>,
475476
* canSign: bool,
@@ -485,7 +486,7 @@
485486
* docmdpLevel: int,
486487
* signersCount: int,
487488
* file: string,
488-
* metadata: LibresignValidateMetadata,
489+
* metadata: LibresignFileRuntimeMetadata,
489490
* size: non-negative-int,
490491
* signers: list<LibresignSignerSummary>,
491492
* }
@@ -499,8 +500,8 @@
499500
* name: string,
500501
* status: int,
501502
* statusText: string,
502-
* nodeType: string,
503-
* metadata: array<string, mixed>,
503+
* nodeType: 'file'|'envelope',
504+
* metadata: LibresignFileRuntimeMetadata,
504505
* size: non-negative-int,
505506
* docmdpLevel: int,
506507
* signatureFlow: 'none'|'parallel'|'ordered_numeric',
@@ -513,7 +514,7 @@
513514
* message: string,
514515
* name: non-falsy-string,
515516
* nodeType: 'file'|'envelope',
516-
* metadata: LibresignValidateMetadata,
517+
* metadata: LibresignFileRuntimeMetadata,
517518
* signatureFlow: 'none'|'parallel'|'ordered_numeric',
518519
* }
519520
* @psalm-type LibresignFileListResponse = array{
@@ -593,7 +594,7 @@
593594
* }
594595
* @psalm-type LibresignConfigValueResponse = array{
595596
* key: string,
596-
* value: mixed,
597+
* value: ?string,
597598
* }
598599
* @psalm-type LibresignIdDocsUploadErrorResponse = array{
599600
* file: ?int,

openapi-full.json

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,8 @@
425425
"type": "string"
426426
},
427427
"value": {
428-
"type": "object"
428+
"type": "string",
429+
"nullable": true
429430
}
430431
}
431432
},
@@ -815,13 +816,14 @@
815816
"type": "string"
816817
},
817818
"nodeType": {
818-
"type": "string"
819+
"type": "string",
820+
"enum": [
821+
"file",
822+
"envelope"
823+
]
819824
},
820825
"metadata": {
821-
"type": "object",
822-
"additionalProperties": {
823-
"type": "object"
824-
}
826+
"$ref": "#/components/schemas/FileRuntimeMetadata"
825827
},
826828
"size": {
827829
"type": "integer",
@@ -890,7 +892,7 @@
890892
]
891893
},
892894
"metadata": {
893-
"$ref": "#/components/schemas/ValidateMetadata"
895+
"$ref": "#/components/schemas/FileRuntimeMetadata"
894896
},
895897
"signatureFlow": {
896898
"type": "string",
@@ -1250,7 +1252,7 @@
12501252
"type": "string"
12511253
},
12521254
"metadata": {
1253-
"$ref": "#/components/schemas/ValidateMetadata"
1255+
"$ref": "#/components/schemas/FileRuntimeMetadata"
12541256
},
12551257
"size": {
12561258
"type": "integer",
@@ -1293,6 +1295,19 @@
12931295
}
12941296
}
12951297
},
1298+
"FileRuntimeMetadata": {
1299+
"anyOf": [
1300+
{
1301+
"$ref": "#/components/schemas/ValidateMetadata"
1302+
},
1303+
{
1304+
"type": "object",
1305+
"additionalProperties": {
1306+
"type": "object"
1307+
}
1308+
}
1309+
]
1310+
},
12961311
"FileSummary": {
12971312
"type": "object",
12981313
"required": [
@@ -1347,7 +1362,7 @@
13471362
"type": "string"
13481363
},
13491364
"metadata": {
1350-
"$ref": "#/components/schemas/ValidateMetadata"
1365+
"$ref": "#/components/schemas/FileRuntimeMetadata"
13511366
},
13521367
"docmdpLevel": {
13531368
"type": "integer",
@@ -1367,7 +1382,9 @@
13671382
},
13681383
"signers": {
13691384
"type": "array",
1370-
"maxItems": 0
1385+
"items": {
1386+
"$ref": "#/components/schemas/SignerSummary"
1387+
}
13711388
},
13721389
"requested_by": {
13731390
"$ref": "#/components/schemas/RequestedBy"

openapi.json

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@
303303
"type": "string"
304304
},
305305
"value": {
306-
"type": "object"
306+
"type": "string",
307+
"nullable": true
307308
}
308309
}
309310
},
@@ -531,13 +532,14 @@
531532
"type": "string"
532533
},
533534
"nodeType": {
534-
"type": "string"
535+
"type": "string",
536+
"enum": [
537+
"file",
538+
"envelope"
539+
]
535540
},
536541
"metadata": {
537-
"type": "object",
538-
"additionalProperties": {
539-
"type": "object"
540-
}
542+
"$ref": "#/components/schemas/FileRuntimeMetadata"
541543
},
542544
"size": {
543545
"type": "integer",
@@ -606,7 +608,7 @@
606608
]
607609
},
608610
"metadata": {
609-
"$ref": "#/components/schemas/ValidateMetadata"
611+
"$ref": "#/components/schemas/FileRuntimeMetadata"
610612
},
611613
"signatureFlow": {
612614
"type": "string",
@@ -851,7 +853,7 @@
851853
"type": "string"
852854
},
853855
"metadata": {
854-
"$ref": "#/components/schemas/ValidateMetadata"
856+
"$ref": "#/components/schemas/FileRuntimeMetadata"
855857
},
856858
"size": {
857859
"type": "integer",
@@ -894,6 +896,19 @@
894896
}
895897
}
896898
},
899+
"FileRuntimeMetadata": {
900+
"anyOf": [
901+
{
902+
"$ref": "#/components/schemas/ValidateMetadata"
903+
},
904+
{
905+
"type": "object",
906+
"additionalProperties": {
907+
"type": "object"
908+
}
909+
}
910+
]
911+
},
897912
"FileSummary": {
898913
"type": "object",
899914
"required": [
@@ -948,7 +963,7 @@
948963
"type": "string"
949964
},
950965
"metadata": {
951-
"$ref": "#/components/schemas/ValidateMetadata"
966+
"$ref": "#/components/schemas/FileRuntimeMetadata"
952967
},
953968
"docmdpLevel": {
954969
"type": "integer",
@@ -968,7 +983,9 @@
968983
},
969984
"signers": {
970985
"type": "array",
971-
"maxItems": 0
986+
"items": {
987+
"$ref": "#/components/schemas/SignerSummary"
988+
}
972989
},
973990
"requested_by": {
974991
"$ref": "#/components/schemas/RequestedBy"

src/types/openapi/openapi-full.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ export type components = {
16301630
};
16311631
ConfigValueResponse: {
16321632
key: string;
1633-
value: Record<string, never>;
1633+
value: string | null;
16341634
};
16351635
ConfigureCheck: {
16361636
message: string;
@@ -1745,10 +1745,9 @@ export type components = {
17451745
/** Format: int64 */
17461746
status: number;
17471747
statusText: string;
1748-
nodeType: string;
1749-
metadata: {
1750-
[key: string]: Record<string, never>;
1751-
};
1748+
/** @enum {string} */
1749+
nodeType: "file" | "envelope";
1750+
metadata: components["schemas"]["FileRuntimeMetadata"];
17521751
/** Format: int64 */
17531752
size: number;
17541753
/** Format: int64 */
@@ -1766,7 +1765,7 @@ export type components = {
17661765
name: string;
17671766
/** @enum {string} */
17681767
nodeType: "file" | "envelope";
1769-
metadata: components["schemas"]["ValidateMetadata"];
1768+
metadata: components["schemas"]["FileRuntimeMetadata"];
17701769
/** @enum {string} */
17711770
signatureFlow: "none" | "parallel" | "ordered_numeric";
17721771
};
@@ -1865,7 +1864,7 @@ export type components = {
18651864
/** Format: int64 */
18661865
signersCount: number;
18671866
file: string;
1868-
metadata: components["schemas"]["ValidateMetadata"];
1867+
metadata: components["schemas"]["FileRuntimeMetadata"];
18691868
/** Format: int64 */
18701869
size: number;
18711870
signers: components["schemas"]["SignerSummary"][];
@@ -1875,6 +1874,9 @@ export type components = {
18751874
data: (components["schemas"]["FileSummary"] | components["schemas"]["DetailedFile"])[];
18761875
settings?: components["schemas"]["Settings"];
18771876
};
1877+
FileRuntimeMetadata: components["schemas"]["ValidateMetadata"] | {
1878+
[key: string]: Record<string, never>;
1879+
};
18781880
FileSummary: {
18791881
/** Format: int64 */
18801882
id: number;
@@ -1888,14 +1890,14 @@ export type components = {
18881890
/** @enum {string} */
18891891
nodeType: "file" | "envelope";
18901892
created_at: string;
1891-
metadata: components["schemas"]["ValidateMetadata"];
1893+
metadata: components["schemas"]["FileRuntimeMetadata"];
18921894
/** Format: int64 */
18931895
docmdpLevel: number;
18941896
/** @enum {string} */
18951897
signatureFlow: "none" | "parallel" | "ordered_numeric";
18961898
/** Format: int64 */
18971899
signersCount: number;
1898-
signers: unknown[];
1900+
signers: components["schemas"]["SignerSummary"][];
18991901
requested_by: components["schemas"]["RequestedBy"];
19001902
/** Format: int64 */
19011903
filesCount: number;

src/types/openapi/openapi.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ export type components = {
11181118
};
11191119
ConfigValueResponse: {
11201120
key: string;
1121-
value: Record<string, never>;
1121+
value: string | null;
11221122
};
11231123
Coordinate: {
11241124
/** Format: int64 */
@@ -1190,10 +1190,9 @@ export type components = {
11901190
/** Format: int64 */
11911191
status: number;
11921192
statusText: string;
1193-
nodeType: string;
1194-
metadata: {
1195-
[key: string]: Record<string, never>;
1196-
};
1193+
/** @enum {string} */
1194+
nodeType: "file" | "envelope";
1195+
metadata: components["schemas"]["FileRuntimeMetadata"];
11971196
/** Format: int64 */
11981197
size: number;
11991198
/** Format: int64 */
@@ -1211,7 +1210,7 @@ export type components = {
12111210
name: string;
12121211
/** @enum {string} */
12131212
nodeType: "file" | "envelope";
1214-
metadata: components["schemas"]["ValidateMetadata"];
1213+
metadata: components["schemas"]["FileRuntimeMetadata"];
12151214
/** @enum {string} */
12161215
signatureFlow: "none" | "parallel" | "ordered_numeric";
12171216
};
@@ -1279,7 +1278,7 @@ export type components = {
12791278
/** Format: int64 */
12801279
signersCount: number;
12811280
file: string;
1282-
metadata: components["schemas"]["ValidateMetadata"];
1281+
metadata: components["schemas"]["FileRuntimeMetadata"];
12831282
/** Format: int64 */
12841283
size: number;
12851284
signers: components["schemas"]["SignerSummary"][];
@@ -1289,6 +1288,9 @@ export type components = {
12891288
data: (components["schemas"]["FileSummary"] | components["schemas"]["DetailedFile"])[];
12901289
settings?: components["schemas"]["Settings"];
12911290
};
1291+
FileRuntimeMetadata: components["schemas"]["ValidateMetadata"] | {
1292+
[key: string]: Record<string, never>;
1293+
};
12921294
FileSummary: {
12931295
/** Format: int64 */
12941296
id: number;
@@ -1302,14 +1304,14 @@ export type components = {
13021304
/** @enum {string} */
13031305
nodeType: "file" | "envelope";
13041306
created_at: string;
1305-
metadata: components["schemas"]["ValidateMetadata"];
1307+
metadata: components["schemas"]["FileRuntimeMetadata"];
13061308
/** Format: int64 */
13071309
docmdpLevel: number;
13081310
/** @enum {string} */
13091311
signatureFlow: "none" | "parallel" | "ordered_numeric";
13101312
/** Format: int64 */
13111313
signersCount: number;
1312-
signers: unknown[];
1314+
signers: components["schemas"]["SignerSummary"][];
13131315
requested_by: components["schemas"]["RequestedBy"];
13141316
/** Format: int64 */
13151317
filesCount: number;

0 commit comments

Comments
 (0)