Repository navigation
fix(signing): preserve nullable code request contracts - #9454
Conversation
vitormattos
left a comment
There was a problem hiding this comment.
@lfals, please address the integration issue below and request another review once the updated branch and CI are ready.
This PR needs to be updated against the current main before merging.
PR #9449 has already made IdDocsUploadErrorResponse.type non-nullable, but this branch's generated openapi-full.json still includes null in that enum.
The current main also contains #9450's required policy value contract and #9457's strict OpenAPI/TypeScript generation tests.
Please resolve the conflicts and regenerate the OpenAPI specifications and TypeScript types from the combined PHP source, ensuring that:
- The ID-document error
typeremains non-nullable. - The signing-code fields retain the intended nullable enums.
- The policy contracts introduced by #9450 remain intact.
- Both
OpenApiGenerationTest.phpandOpenApiSigningCodeContractTest.phpremain registered in the OpenAPI PHPUnit suite.
Then rerun composer run openapi, the OpenAPI PHPUnit suite, npm run ts:check, and the PR CI checks.
This is an integration requirement, not a defect in the nullable-enum fix itself.
57cca82 to
4b79c6a
Compare
Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
4b79c6a to
e651e9e
Compare
Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Problem
The signing-code endpoints accept null for
identifyMethodandidDocApproval, but generated Hey API types reject it. The extractor emitsnullable: truewith an enum that excludes null. In OpenAPI 3.0, nullable does not override the enum constraint.The PHP methods also require positional
identifyMethodandsignMethodarguments despite the generated request bodies describing them as optional.Solution
identifyMethod: 'account' | 'email' | nullandidDocApproval: 'true' | null.identifyMethodandsignMethodexplicit null defaults in both code-request methods.Only the literal string
"true"selects the ID-document approval flow. Missing methods still reach the existing validation/error path; this does not choose a signing method automatically or bypass signing validation.Tests and evidence
ArgumentCountErrorerrors. The SDK compilation fixture rejected null in bothidentifyMethodfields and inidDocApproval.SignFileControllerTestpassed in an isolated PHPUnit bootstrap: 19 tests, 67 assertions. This used the current checkout's classes and installed OCP dependencies, without a bootstrapped Nextcloud server.vendor-bin/phpunit/vendor/bin/phpunit -c tests/php/openapi/phpunit.xml: 16 tests, 168 assertions.npm run ts:check: passed."false", and unsupported identification methods.git diff --check: passed.Known limits
Compatibility and related work
Based directly on
mainatc0e2e302605ed51ff87931ec47ff69c80db2d331, independently of #9453 and the policy changes.The patch also adds null to the currently nullable
IdDocsUploadErrorResponse.typeenum when regenerating from this base. It does not change that endpoint's PHP/runtime behavior. #9449 removes that field's nullability; after combining the PRs and regenerating, the patch leaves its non-nullable enum unchanged. #9451's error-handling changes are not included.Reference: OpenAPI 3.0.3 Schema Object.