Skip to content

feat(openapi): apply functional tags to LibreSign endpoints - #9341

Merged
vitormattos merged 17 commits into
LibreSign:mainfrom
lfals:feat/openapi-functional-tags-9088
Nov 9, 2026
Merged

vitormattos merged 17 commits into
LibreSign:mainfrom
lfals:feat/openapi-functional-tags-9088

Conversation

@lfals

@lfals lfals commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Resolves: #9088

📝 Summary

Applies the approved functional OpenAPI taxonomy to LibreSign controller operations via method-level #[OpenAPI(tags: [...])] attributes, then regenerates the OpenAPI specs.

Controller-name tags (account, admin, file, policy, …) are replaced by the ten functional tags used for SDK grouping: appearance, certificates, documents, identity, notifications, policies, requests, signing, system, and verification.

After syncing with main, also classifies the newer endpoints notify-status → notifications and signature_elements-use-saved-signature-elements → appearance.

Bumps nextcloud/openapi-extractor to stable v1.9.1 so scoped path merges keep both HTTP methods on the same path (fixes the previous GET/POST /footer-template full-spec omission). PHPUnit under tests/php/openapi/ enforces approved tags, uniqueness, scoped/full consistency (by operationId and route), and raw object equality—without a second operation inventory.

Current union counts:

Spec Operations
openapi.json 69
openapi-administration.json 21
openapi-full.json 90
Union 90

Extractor 1.9.1 contract churn (no production behavior change)

All of the following come from regenerating with extractor v1.9.1; runtime handlers were not rewritten for these items:

  • Implicit 401/403 responses: 41 new 401 responses in openapi.json; 19 401 + 19 403 in openapi-administration.json (OCS auth documentation).
  • Boolean query parameters: former integer/enum [0,1] query params (a, forceIcon, mimeFallback, show*, file/list filters, deleteFile, …) are now documented as boolean. Nextcloud’s Dispatcher still accepts "true"/"1".
  • Nullable formatting: default: null on nullable parameters; some nullable property $refs become allOf.
  • Headers / prose: libresign-sign-request-uuid on signature/elements; CORS note text on two descriptions.
  • Unused schemas removed from full: 11 unreferenced schemas dropped (DocMdpConfig, ReminderSettings, *WriteRequest, …). None were referenced from src/ outside generated types.
  • New documented parameter: idDocApproval on POST /sign/uuid/{uuid}/code, bound as ?string and compared with === 'true' to match InjectionMiddleware.

🧪 How to test

  1. Confirm PHP attributes under lib/Controller/ use only approved functional tags (and preserve existing scopes).
  2. Regenerate and confirm the tree stays clean:
    composer run openapi
    git status --porcelain openapi*.json src/types/openapi/
  3. Run the OpenAPI PHPUnit suite:
    vendor/bin/phpunit -c tests/php/openapi/phpunit.xml
  4. Optional: open openapi-full.json in Swagger UI and verify functional grouping with no legacy tag sections.

Validation evidence

  • Focused regression/acceptance test (tests/php/openapi, SignFileControllerTest)
  • Relevant lint/type/static-analysis checks (composer psalm, npm run ts:check)
  • Broader suite required by the changed surface
  • CI reviewed

⚙️ API / Back-end changes

  • Reclassified documented operations with functional OpenAPI tags in PHP controllers
  • Regenerated openapi.json, openapi-administration.json, and openapi-full.json via composer openapi
  • Unit and/or integration tests added or updated (tests/php/openapi)
  • Authorization and negative paths checked when applicable (scopes/NoAdminRequired/routes preserved; idDocApproval keeps middleware semantics)
  • Capabilities updated when applicable
  • Documentation updated when applicable (AGENTS.md)
  • API documentation regenerated with composer openapi when necessary

🚧 Tasks

  • Apply approved tag mapping in PHP #[OpenAPI] attributes
  • Bump openapi-extractor to ^1.9.1 and regenerate
  • Require full = scoped union with no omission allowlist
  • Reject tags outside APPROVED_TAGS (no LEGACY_TAGS)
  • CI review on the draft PR

✅ Checklist

  • I have read and followed the contribution guide.
  • The diff does not contain unrelated refactors or generated changes.
  • Commits follow Conventional Commits where applicable.
  • All commits include the required DCO sign-off.

🤖 AI (if applicable)

  • The content of this PR was partially or fully generated using AI

@lfals
lfals requested a review from a team as a code owner November 4, 2026 00:51
@lfals
lfals marked this pull request as draft November 4, 2026 00:51
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T20:44:43.463261Z 00593aa New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6d5213f07

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/openapi/check-functional-tags.php Resolved
@lfals lfals self-assigned this Nov 4, 2026
Comment thread CONTRIBUTING.md Resolved
@lfals
lfals marked this pull request as ready for review November 4, 2026 11:51

@vitormattos vitormattos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes to consolidate the OpenAPI taxonomy checks in the existing test infrastructure and ensure they are enforced by CI. No manual edits to generated OpenAPI JSON files are requested.

Comment thread composer.json Resolved
Comment thread Makefile Resolved

@vitormattos vitormattos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the inline findings and keep functional OpenAPI tagging and auto-generated JSONs. The revised tests should accept a new correctly tagged endpoint without test-code changes, while rejecting invalid tags and duplicate IDs.

@vitormattos vitormattos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional file-specific cleanup suggestion.

Comment thread .github/workflows/openapi.yml.patch Resolved
@lfals
lfals requested a review from vitormattos November 5, 2026 15:22
@vitormattos vitormattos added this to the Next Major (36) milestone Nov 7, 2026
@lfals
lfals force-pushed the feat/openapi-functional-tags-9088 branch 2 times, most recently from 6feb56e to 0afdc9b Compare November 9, 2026 18:26

@vitormattos vitormattos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the work done so far, especially the move to PHPUnit and the improvements to the OpenAPI tag checks.

I have two follow-up comments for the next iteration: please fix the incomplete generated full specification at its source (rather than allowlisting the omission), and simplify the tag validation by removing the redundant legacy-tag inventory. The isolated PHPUnit configuration is fine as it is.

Could you please address these points, regenerate the specifications, and request another review when the CI checks have been rerun? Thanks again for the progress so far.

@lfals
lfals requested a review from vitormattos November 9, 2026 19:39
@lfals
lfals force-pushed the feat/openapi-functional-tags-9088 branch from 7db8c9a to 2ba9f22 Compare November 9, 2026 19:47
@vitormattos
vitormattos enabled auto-merge November 9, 2026 19:58
lfals added 11 commits November 9, 2026 17:38
Assign the approved OpenAPI taxonomy from issue LibreSign#9088 via
method-level #[OpenAPI(tags: [...])] attributes. Preserve
administration scope, routes, and authorization attributes.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>

Co-authored-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Regenerate openapi.json, openapi-administration.json and
openapi-full.json through composer run openapi after the
controller attribute updates. TypeScript generation produced
no additional diff.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>

Co-authored-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Verify the approved tag vocabulary, one tag per operation,
unique operationIds, and the expected union counts without
booting Nextcloud or a database.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>

Co-authored-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Document how to tag new PHP endpoints and regenerate the
specifications.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>

Co-authored-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Catch tag swaps that leave vocabulary and aggregate counts
unchanged by locking all 88 documented operationIds.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>

Co-authored-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Issue LibreSign#9088 asked for a lightweight PHP/composer static check,
not a new GitHub Actions workflow.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>

Co-authored-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Apply the approved functional tags to endpoints introduced on main
after the LibreSign#9088 taxonomy work.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Keep durable classification prose for LibreSign/documentation later.
Retain the short functional-tag reminder in AGENTS.md.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Replace the standalone script with an isolated PHPUnit suite that does
not boot Nextcloud, and run it from the existing OpenAPI workflow.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
lfals added 6 commits November 9, 2026 17:38
Validate generated specs for approved tags and unique identities
without a second registry of operationIds or tag counts.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Use the stable extractor release required for method-aware path merges
and stricter OpenAPI type extraction.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Rename the OCS-aware base controller so extractor 1.9 detects OCS
routes, move unused Psalm aliases out of ResponseDefinitions, replace
TYPE[] docs with list<>/array shapes, and keep Psalm/TS checks green
after the stricter generated contracts.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Expose the identification-document approval flag as an explicit
nullable string parameter so OpenAPI documents it and runtime stays
aligned with InjectionMiddleware's strict 'true' comparison.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Refresh default, administration, full, and TypeScript clients after
the extractor bump so scoped and full contracts stay in sync.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
Drop known full-spec omissions and legacy-tag exceptions, compare full
coverage by operationId and route, and keep raw scoped/full objects equal.

Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
auto-merge was automatically disabled November 9, 2026 20:38

Head branch was modified

@lfals
lfals force-pushed the feat/openapi-functional-tags-9088 branch from 2ba9f22 to 00593aa Compare November 9, 2026 20:38
@vitormattos
vitormattos merged commit b02d0b8 into LibreSign:main Nov 9, 2026
81 of 138 checks passed
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.

Define and apply functional OpenAPI tags to all LibreSign endpoints

2 participants