Skip to content

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

Open
lfals wants to merge 13 commits into
LibreSign:mainfrom
lfals:feat/openapi-functional-tags-9088
Open

lfals wants to merge 13 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.

Contract inventory (paths, methods, operationIds, schemas, security, and API scopes) is unchanged aside from tags/tag metadata. Current union counts:

Tag Operations
appearance 17
certificates 12
documents 6
identity 14
notifications 4
policies 17
requests 5
signing 8
system 3
verification 4
Total 90

openapi.json: 69 · openapi-administration.json: 21 · openapi-full.json: 89
(known extractor omission in full: footer_template-get-footer-template)

Also adds:

  • static check composer openapi:check-tags / make openapi-check-tags with a golden operationId → tag map
  • contributor guidance in CONTRIBUTING.md / AGENTS.md for classifying future endpoints

🧪 How to test

  1. Confirm PHP attributes on the affected controllers under lib/Controller/ use only approved functional tags (and preserve any existing SCOPE_ADMINISTRATION / SCOPE_IGNORE).
  2. Regenerate and confirm the tree stays clean:
    composer run openapi
    git status --porcelain openapi*.json src/types/openapi/
  3. Run the taxonomy check:
    composer openapi:check-tags
    Expected: OpenAPI functional tags OK with the counts above.
  4. Optional visual check: open openapi-full.json in Swagger UI and verify grouping, for example:
    • GET .../notify/status under notifications
    • POST .../signature/elements/saved under appearance
    • no leftover legacy tag sections such as account, admin, file, notify, signature_elements

Validation evidence

  • Focused regression/acceptance test
  • Relevant lint/type/static-analysis checks
  • 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/openapi/check-functional-tags.php golden map + vocabulary checks)
  • Authorization and negative paths checked when applicable (scopes/NoAdminRequired/routes preserved; no auth behavior changes)
  • Capabilities updated when applicable
  • Documentation updated when applicable (CONTRIBUTING.md, AGENTS.md)
  • API documentation regenerated with composer openapi when necessary

🚧 Tasks

  • Apply approved tag mapping in PHP #[OpenAPI] attributes
  • Regenerate OpenAPI artifacts through the established workflow
  • Add static verification for approved tags / one tag per operation / golden map
  • Document how to classify new endpoints
  • 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 added 10 commits October 25, 2026 11:25
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>
@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

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T14:27:29.820197Z dbf9396 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 Outdated
'certificates' => 12,
'documents' => 6,
'identity' => 14,
'notifications' => 3,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Classify both omitted endpoints before finalizing the taxonomy

When composer openapi:check-tags (now part of make check) runs, it fails: the generated specs still tag notify-status and signature_elements-use-saved-signature-elements as notify and signature_elements, since NotifyController::status() and SignatureElementsController::useSavedSignatureElements() lack method-level functional tags; the golden inventory here also accounts for only 88 of the 90 operations. Add the two source attributes and map entries so these operations no longer remain in legacy Swagger groups and the new check passes.

AGENTS.md reference: AGENTS.md:L82-L88

Useful? React with 👍 / 👎.

@lfals lfals self-assigned this Nov 4, 2026
Comment thread CONTRIBUTING.md Resolved
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>
@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
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>

@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.

'footer_template-get-footer-template',
];

public const EXPECTED_OPERATION_TAGS = [

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.

Blocking — avoid maintaining a second endpoint registry. EXPECTED_OPERATION_TAGS duplicates the operations already defined by controller attributes and generated OpenAPI specifications. Adding a correctly tagged endpoint will fail until this list is edited. Please remove this inventory and collectGoldenMapErrors(), and validate operations directly from the generated specs. Keep checks for approved tags, missing or multiple tags, and duplicates.

'verification',
];

public const EXPECTED_UNION_COUNTS = [

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.

Blocking — remove hardcoded operation counts. EXPECTED_UNION_COUNTS makes a valid new endpoint fail CI merely because the number of operations in its category changed. Please remove fixed totals and associated assertions. If useful for diagnostics, calculate counts dynamically.

* @param list<array{operationId: string, method: string, path: string, tags: list<string>}> $operations
* @return array<string, array{operationId: string, method: string, path: string, tags: list<string>}>
*/
public static function indexById(array $operations): array {

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.

indexById() silently overwrites entries with the same operationId. Please validate duplicates before indexing and when combining scoped specifications, so collisions cannot be hidden. Compare method/path identities where needed instead of relying only on an associative map keyed by operationId.

@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.


- name: Get php version
id: php_versions
@@ -84,6 +85,9 @@

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.

This .patch file duplicates the change already applied to .github/workflows/openapi.yml. Please remove this artifact unless it is actually consumed by a documented build or maintenance process.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Kept on purpose. sync-workflow-templates.yml reapplies .github/workflows/*.yml.patch after syncing the organization template.

Without this file, the next workflow sync would drop both submodules: true and the OpenAPI PHPUnit step from openapi.yml.

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>
@lfals
lfals requested a review from vitormattos November 5, 2026 15:22

This branch has not been deployed

No deployments
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