Skip to content

Commit f7e71a9

Browse files
committed
fix: align frontend policy typing after OpenAPI regen
Signed-off-by: Vitor Mattos <[email protected]>
1 parent 3c40c70 commit f7e71a9

8 files changed

Lines changed: 52 additions & 9 deletions

File tree

lib/ResponseDefinitions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@
361361
*
362362
* Validation and progress contracts
363363
*
364-
* @psalm-type LibresignEffectivePolicyValue = null|bool|int|float|string|array<array-key, mixed>
364+
* @psalm-type LibresignEffectivePolicyValue = null|bool|int|float|string|array<string, mixed>
365365
* @psalm-type LibresignEffectivePolicyState = array{
366366
* policyKey: string,
367367
* effectiveValue: LibresignEffectivePolicyValue,

openapi-administration.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,12 @@
464464
},
465465
{
466466
"type": "string"
467+
},
468+
{
469+
"type": "object",
470+
"additionalProperties": {
471+
"type": "object"
472+
}
467473
}
468474
]
469475
},
@@ -556,7 +562,8 @@
556562
"template",
557563
"isDefault",
558564
"preview_width",
559-
"preview_height"
565+
"preview_height",
566+
"preview_zoom"
560567
],
561568
"properties": {
562569
"template": {
@@ -572,6 +579,10 @@
572579
"preview_height": {
573580
"type": "integer",
574581
"format": "int64"
582+
},
583+
"preview_zoom": {
584+
"type": "integer",
585+
"format": "int64"
575586
}
576587
}
577588
},

openapi-full.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,12 @@
10701070
},
10711071
{
10721072
"type": "string"
1073+
},
1074+
{
1075+
"type": "object",
1076+
"additionalProperties": {
1077+
"type": "object"
1078+
}
10731079
}
10741080
]
10751081
},
@@ -1557,7 +1563,8 @@
15571563
"template",
15581564
"isDefault",
15591565
"preview_width",
1560-
"preview_height"
1566+
"preview_height",
1567+
"preview_zoom"
15611568
],
15621569
"properties": {
15631570
"template": {
@@ -1573,6 +1580,10 @@
15731580
"preview_height": {
15741581
"type": "integer",
15751582
"format": "int64"
1583+
},
1584+
"preview_zoom": {
1585+
"type": "integer",
1586+
"format": "int64"
15761587
}
15771588
}
15781589
},

openapi.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,12 @@
724724
},
725725
{
726726
"type": "string"
727+
},
728+
{
729+
"type": "object",
730+
"additionalProperties": {
731+
"type": "object"
732+
}
727733
}
728734
]
729735
},

src/types/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export type SignatureFlowValue = SignatureFlowMode | 0 | 1 | 2
5454
export type EffectivePoliciesResponse = ApiOcsResponseData<ApiOperations['policy-effective'], 200>
5555
export type EffectivePoliciesState = EffectivePoliciesResponse['policies']
5656
export type EffectivePolicyState = ApiRecordValue<EffectivePoliciesState>
57-
export type EffectivePolicyValue = Exclude<ApiRequestJsonBody<AdminOperations['policy-set-system']>['value'], undefined>
57+
export type EffectivePolicyValue = Exclude<EffectivePolicyState['effectiveValue'], undefined>
5858
export type GroupPolicyResponse = ApiOcsResponseData<ApiOperations['policy-get-group'], 200>
5959
export type GroupPolicyState = GroupPolicyResponse['policy']
6060

@@ -75,9 +75,14 @@ export type UserPolicyState = Omit<OpenApiUserPolicyState, 'value'> & {
7575
export type UserPolicyResponse = {
7676
policy: UserPolicyState
7777
}
78-
export type GroupPolicyWritePayload = ApiRequestJsonBody<ApiOperations['policy-set-group']>
78+
export type GroupPolicyWritePayload = {
79+
value: EffectivePolicyValue
80+
allowChildOverride: boolean
81+
}
7982
export type GroupPolicyWriteResponse = ApiOcsResponseData<ApiOperations['policy-set-group'], 200>
80-
export type SystemPolicyWritePayload = ApiRequestJsonBody<AdminOperations['policy-set-system']>
83+
export type SystemPolicyWritePayload = {
84+
value: EffectivePolicyValue
85+
}
8186
export type SystemPolicyWriteResponse = ApiOcsResponseData<AdminOperations['policy-set-system'], 200>
8287
export type SystemPolicyWriteErrorResponse = ApiOcsResponseData<AdminOperations['policy-set-system'], 400>
8388
export type NewFilePayload = ApiComponents['schemas']['NewFile']

src/types/openapi/openapi-administration.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,9 @@ export type components = {
634634
/** Format: int64 */
635635
userCount: number;
636636
};
637-
EffectivePolicyValue: (boolean | number | string) | null;
637+
EffectivePolicyValue: (boolean | number | string | {
638+
[key: string]: Record<string, never>;
639+
}) | null;
638640
EngineHandler: {
639641
configPath: string;
640642
cfsslUri?: string;
@@ -664,6 +666,8 @@ export type components = {
664666
preview_width: number;
665667
/** Format: int64 */
666668
preview_height: number;
669+
/** Format: int64 */
670+
preview_zoom: number;
667671
};
668672
HasRootCertResponse: {
669673
hasRootCert: boolean;

src/types/openapi/openapi-full.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1897,7 +1897,9 @@ export type components = {
18971897
/** Format: int64 */
18981898
userCount: number;
18991899
};
1900-
EffectivePolicyValue: (boolean | number | string) | null;
1900+
EffectivePolicyValue: (boolean | number | string | {
1901+
[key: string]: Record<string, never>;
1902+
}) | null;
19011903
EngineHandler: {
19021904
configPath: string;
19031905
cfsslUri?: string;
@@ -2038,6 +2040,8 @@ export type components = {
20382040
preview_width: number;
20392041
/** Format: int64 */
20402042
preview_height: number;
2043+
/** Format: int64 */
2044+
preview_zoom: number;
20412045
};
20422046
GroupPolicyResponse: {
20432047
policy: components["schemas"]["GroupPolicyState"];

src/types/openapi/openapi.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,9 @@ export type components = {
12931293
/** Format: int64 */
12941294
userCount: number;
12951295
};
1296-
EffectivePolicyValue: (boolean | number | string) | null;
1296+
EffectivePolicyValue: (boolean | number | string | {
1297+
[key: string]: Record<string, never>;
1298+
}) | null;
12971299
ErrorItem: {
12981300
message: string;
12991301
title?: string;

0 commit comments

Comments
 (0)