From 740fdf4a7b3bce2c74892993698c321c82a77f27 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 18:17:42 +0000 Subject: [PATCH 1/3] refactor(openapi): express policy numeric alternatives without overlap (#9089) Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- lib/ResponseDefinitions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ResponseDefinitions.php b/lib/ResponseDefinitions.php index a922520630..049ac0f68d 100644 --- a/lib/ResponseDefinitions.php +++ b/lib/ResponseDefinitions.php @@ -433,7 +433,7 @@ * Validation and progress contracts * * @psalm-type LibresignPolicyScope = 'system'|'group'|'user' - * @psalm-type LibresignEffectivePolicyValue = null|bool|int|float|string|array + * @psalm-type LibresignEffectivePolicyValue = null|bool|numeric|string|array * @psalm-type LibresignEffectivePolicyMeta = array{ * defaultSystemValue?: LibresignEffectivePolicyValue, * appConfigKey?: string, From 6bcabeed6864d5201e33f9dddf8449918efdc704 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 18:18:22 +0000 Subject: [PATCH 2/3] test(openapi): guard disjoint policy number schema across scopes (#9089) Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .../openapi/OpenApiPolicyNumberUnionTest.php | 44 +++++++++++++++++++ tests/php/openapi/phpunit.xml | 1 + 2 files changed, 45 insertions(+) create mode 100644 tests/php/openapi/OpenApiPolicyNumberUnionTest.php diff --git a/tests/php/openapi/OpenApiPolicyNumberUnionTest.php b/tests/php/openapi/OpenApiPolicyNumberUnionTest.php new file mode 100644 index 0000000000..6e23133f73 --- /dev/null +++ b/tests/php/openapi/OpenApiPolicyNumberUnionTest.php @@ -0,0 +1,44 @@ + ['openapi.json'], + 'administration scope' => ['openapi-administration.json'], + 'full scope' => ['openapi-full.json'], + ]; + } + + #[DataProvider('specificationProvider')] + public function testPolicyValueUsesDisjointJsonNumberBranch(string $file): void { + $source = file_get_contents(dirname(__DIR__, 3) . '/' . $file); + self::assertNotFalse($source); + + $spec = json_decode($source, true, 512, JSON_THROW_ON_ERROR); + $schema = $spec['components']['schemas']['EffectivePolicyValue'] ?? null; + self::assertIsArray($schema); + self::assertArrayNotHasKey('anyOf', $schema); + self::assertArrayHasKey('oneOf', $schema); + + // JSON numbers include both integers and decimals. A separate integer + // branch would overlap with number and change oneOf semantics. + $types = array_map( + static fn (array $item): ?string => $item['type'] ?? null, + $schema['oneOf'], + ); + sort($types); + self::assertSame(['boolean', 'number', 'object', 'string'], $types); + } +} diff --git a/tests/php/openapi/phpunit.xml b/tests/php/openapi/phpunit.xml index 8845dd9e2c..f070551adf 100644 --- a/tests/php/openapi/phpunit.xml +++ b/tests/php/openapi/phpunit.xml @@ -15,6 +15,7 @@ OpenApiFunctionalTagsTest.php OpenApiGenerationTest.php + OpenApiPolicyNumberUnionTest.php OpenApiRequestHeadersTest.php From d9ecc510e1d991af9a1498c9a5b40a59d09d7785 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 18:27:22 +0000 Subject: [PATCH 3/3] chore(openapi): regenerate policy value schemas from PHPDoc (#9089) Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- openapi-administration.json | 9 ++------- openapi-full.json | 9 ++------- openapi.json | 9 ++------- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/openapi-administration.json b/openapi-administration.json index 01a86436ec..09d6ac70dd 100644 --- a/openapi-administration.json +++ b/openapi-administration.json @@ -565,17 +565,12 @@ }, "EffectivePolicyValue": { "nullable": true, - "anyOf": [ + "oneOf": [ { "type": "boolean" }, { - "type": "integer", - "format": "int64" - }, - { - "type": "number", - "format": "double" + "type": "number" }, { "type": "string" diff --git a/openapi-full.json b/openapi-full.json index 322fd4425f..e707ffd1ee 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -1072,17 +1072,12 @@ }, "EffectivePolicyValue": { "nullable": true, - "anyOf": [ + "oneOf": [ { "type": "boolean" }, { - "type": "integer", - "format": "int64" - }, - { - "type": "number", - "format": "double" + "type": "number" }, { "type": "string" diff --git a/openapi.json b/openapi.json index b0fe478181..bf1e6ae853 100644 --- a/openapi.json +++ b/openapi.json @@ -799,17 +799,12 @@ }, "EffectivePolicyValue": { "nullable": true, - "anyOf": [ + "oneOf": [ { "type": "boolean" }, { - "type": "integer", - "format": "int64" - }, - { - "type": "number", - "format": "double" + "type": "number" }, { "type": "string"