Skip to content

refactor(openapi): use disjoint JSON number type for policy values (#9089) - #9494

Merged
vitormattos merged 3 commits into
mainfrom
fix/9089-disjoint-policy-numbers
Nov 14, 2026
Merged

vitormattos merged 3 commits into
mainfrom
fix/9089-disjoint-policy-numbers

Conversation

@vitormattos

@vitormattos vitormattos commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Motivation

The typescript-axios No-Go in #9437 is partially caused by the EffectivePolicyValue schema's overlapping integer and number branches. Because integer values also satisfy OpenAPI number, the pinned nextcloud/openapi-extractor 1.9.1 correctly emits anyOf, which OpenAPI Generator 7.27.0 currently mishandles.

Change (no extractor changes)

  • Replace only int|float|string with numeric|string in the PHPDoc alias LibresignEffectivePolicyValue. Psalm's numeric comprises int, float, and numeric-string; since the union already includes every string, the set of PHP values is unchanged.
  • The pinned extractor already maps numeric to OpenAPI number. The expected JSON alternatives are therefore disjoint: boolean, number, string and object. This allows the extractor to emit oneOf for a real semantic reason, not by rewriting generated OpenAPI keywords.
  • Add an OpenAPI PHPUnit regression checking the disjoint branches in default, administration and full specs.

Scope and known remaining limitations

Verification

  • Pre-change: EffectivePolicyValue was nullable: true with anyOf branches boolean, integer, number, string and object in all three specs.
  • Official generation completed: GitHub Actions OpenAPI workflow 43625885683 executed composer openapi successfully and produced exactly three JSON diffs, changing anyOf to oneOf and combining the overlapping integer / number branches into a single number branch. The existing openapi-typescript outputs were unchanged. The generated JSON diffs were committed verbatim in d9ecc510; no generator output was hand-invented.
  • The same CI run's OpenAPI PHPUnit suite passed: 28 tests, 712 assertions, including the new three-scope policy union regression. The initial run's final consistency check failed solely because the three regenerated files had not yet been committed; that discrepancy has been addressed.
  • Psalm, PHP-CS-Fixer, type checking, ESLint and build passed on the pre-regeneration commit.
  • 3 incremental commits signed and DCO-verified by Git Signing MCP.
  • Still pending: complete revalidation of the final commit, plus an independent typescript-axios generation/type-safety experiment on the updated specification. This change does not correct loss of null, the additionalProperties mapping, or multipart schemas.
  • The PR remains Draft until the final-head CI and meaningful SDK regression checks are reviewed.

Related: #9089, #9437, #9453; upstream nextcloud/openapi-extractor#401.

#9089)

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Code Metrics Report

Note: Metrics describe the revision analyzed by the successful PHPUnit run. Newer commits with pending, canceled or failed checks may not yet be represented in this report.

main (643cefc) #9494 (e1360e2) +/-
Coverage 76.6% 76.6% 0.0%
Test Execution Time 2m26s 3m21s +55s
Details
  |                     | main (643cefc) | #9494 (e1360e2) | +/-  |
  |---------------------|----------------|-----------------|------|
  | Coverage            |          76.6% |           76.6% | 0.0% |
  |   Files             |            512 |             512 |    0 |
  |   Lines             |          28862 |           28862 |    0 |
  |   Covered           |          22115 |           22115 |    0 |
- | Test Execution Time |          2m26s |           3m21s | +55s |

Code coverage of files in pull request scope (0.0% → 0.0%)

Files Coverage +/- Status
lib/ResponseDefinitions.php 0.0% 0.0% modified

Reported by octocov

@vitormattos
vitormattos marked this pull request as ready for review November 14, 2026 20:12
@vitormattos
vitormattos requested a review from a team as a code owner November 14, 2026 20:12
@vitormattos
vitormattos merged commit 8018115 into main Nov 14, 2026
81 checks passed
@vitormattos
vitormattos deleted the fix/9089-disjoint-policy-numbers branch November 14, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant