Repository navigation
refactor(openapi): use disjoint JSON number type for policy values (#9089) - #9494
Merged
Merged
Conversation
#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>
Contributor
Code Metrics ReportNote: 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.
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%)
Reported by octocov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The
typescript-axiosNo-Go in #9437 is partially caused by theEffectivePolicyValueschema's overlappingintegerandnumberbranches. Because integer values also satisfy OpenAPInumber, the pinnednextcloud/openapi-extractor1.9.1 correctly emitsanyOf, which OpenAPI Generator 7.27.0 currently mishandles.Change (no extractor changes)
int|float|stringwithnumeric|stringin the PHPDoc aliasLibresignEffectivePolicyValue. Psalm'snumericcomprises int, float, and numeric-string; since the union already includes every string, the set of PHP values is unchanged.numericto OpenAPInumber. The expected JSON alternatives are therefore disjoint: boolean, number, string and object. This allows the extractor to emitoneOffor a real semantic reason, not by rewriting generated OpenAPI keywords.Scope and known remaining limitations
array<string, mixed>is still mapped too narrowly to object-valued properties; multipart request bodies remain absent. Both are outside this source-only simplification.typescript-axiostype-generation defect is not fixed by changing a legal schema to suit the generator; a separate generator evaluation is still warranted.Verification
EffectivePolicyValuewasnullable: truewithanyOfbranchesboolean,integer,number,stringandobjectin all three specs.43625885683executedcomposer openapisuccessfully and produced exactly three JSON diffs, changinganyOftooneOfand combining the overlappinginteger/numberbranches into a singlenumberbranch. The existingopenapi-typescriptoutputs were unchanged. The generated JSON diffs were committed verbatim ind9ecc510; no generator output was hand-invented.typescript-axiosgeneration/type-safety experiment on the updated specification. This change does not correct loss ofnull, theadditionalPropertiesmapping, or multipart schemas.Related: #9089, #9437, #9453; upstream nextcloud/openapi-extractor#401.