Skip to content

feat(openapi): add bearerAuth description + apiKeyAuth alias + schema descriptions#3781

Merged
PierreBrisorgueil merged 1 commit into
masterfrom
feat/promote-openapi-bearer-descriptions
Jun 3, 2026
Merged

feat(openapi): add bearerAuth description + apiKeyAuth alias + schema descriptions#3781
PierreBrisorgueil merged 1 commit into
masterfrom
feat/promote-openapi-bearer-descriptions

Conversation

@PierreBrisorgueil
Copy link
Copy Markdown
Contributor

Summary

Improves the devkit OpenAPI baseline in modules/core/doc/index.yml:

  • Unquote type, scheme, bearerFormat values (YAML canonical form — quoted strings → unquoted)
  • Add description to bearerAuth security scheme (generic: explains Authorization: Bearer header pattern)
  • Add apiKeyAuth security scheme as a legacy alias for bearerAuth (description: "Legacy alias for bearerAuth. New integrations should use bearerAuth.")
  • Add description to SuccessResponse schema component
  • Add description to ErrorResponse schema component

Why

These are generic improvements that belong in devkit, not in downstream modules/core/doc/index.yml overrides. The apiKeyAuth alias allows downstreams (e.g. Trawl) that reference apiKeyAuth in route security declarations to work correctly without patching every route annotation. Descriptions make the generated Redoc docs self-explanatory.

Part of T13 Fix B sub-step (infra#38 no-ledger drift cleanup). After this PR merges, the trawl_node side (Fix C) will:

  1. Absorb this change via /update-stack
  2. Revert modules/core/doc/index.yml to the devkit baseline
  3. Relocate trawl-specific tags + x-tagGroups to per-module doc files

Test coverage

6 new unit tests in lib/services/tests/express.docs.unit.tests.js:

  • bearerAuth security scheme exists in merged spec
  • bearerAuth has a description field
  • apiKeyAuth security scheme exists as legacy alias
  • apiKeyAuth description mentions bearerAuth as canonical
  • SuccessResponse schema has a description
  • ErrorResponse schema has a description

All 17 tests in the file pass (6 new + 11 existing). Lint clean.

References

… descriptions

- Unquote type/scheme/bearerFormat (YAML canonical form)
- Add description to bearerAuth security scheme
- Add apiKeyAuth as legacy-alias security scheme (points to bearerAuth)
- Add description to SuccessResponse and ErrorResponse schema components
- 6 new unit tests covering all additions

Closes #3780. References infra#38 (T13 Fix B sub-step).
Copilot AI review requested due to automatic review settings June 3, 2026 13:09
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Warning

Review limit reached

@PierreBrisorgueil, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 13 minutes and 48 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3a78c80e-2759-4e3f-aabf-9090a1ab262a

📥 Commits

Reviewing files that changed from the base of the PR and between 4f505c1 and 1b1899f.

📒 Files selected for processing (2)
  • lib/services/tests/express.docs.unit.tests.js
  • modules/core/doc/index.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/promote-openapi-bearer-descriptions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@PierreBrisorgueil PierreBrisorgueil merged commit cdacb9b into master Jun 3, 2026
7 checks passed
@PierreBrisorgueil PierreBrisorgueil deleted the feat/promote-openapi-bearer-descriptions branch June 3, 2026 13:11
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.19%. Comparing base (3086820) to head (1b1899f).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3781   +/-   ##
=======================================
  Coverage   90.19%   90.19%           
=======================================
  Files         152      152           
  Lines        5020     5020           
  Branches     1598     1598           
=======================================
  Hits         4528     4528           
  Misses        387      387           
  Partials      105      105           
Flag Coverage Δ
integration 59.06% <ø> (ø)
unit 69.34% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4f505c1...1b1899f. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the devkit’s baseline OpenAPI spec by enriching security scheme and schema component descriptions, and adds unit tests intended to guard these baseline expectations in the generated merged spec.

Changes:

  • Enhanced bearerAuth security scheme with a human-readable description and normalized YAML scalar formatting.
  • Added apiKeyAuth as a legacy-named security scheme intended to alias bearerAuth.
  • Added descriptions to SuccessResponse and ErrorResponse schema components, plus new unit tests asserting these fields are present in the served spec.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
modules/core/doc/index.yml Updates baseline OpenAPI components: security schemes + schema descriptions.
lib/services/tests/express.docs.unit.tests.js Adds unit tests asserting the merged spec contains the new baseline descriptions/schemes.

Comment on lines +12 to +16
apiKeyAuth:
type: http
scheme: bearer
description: |
Legacy alias for `bearerAuth`. New integrations should use `bearerAuth`.
schemas:
SuccessResponse:
type: object
description: Standard success envelope. data type varies by endpoint.
Comment on lines +77 to +86
beforeEach(() => {
jest.resetModules();
jest.unstable_mockModule('fs', () => ({
default: { readFileSync: jest.fn().mockReturnValue('mocked') },
readFileSync: jest.fn().mockReturnValue('mocked'),
}));
jest.unstable_mockModule('js-yaml', () => ({
default: { load: jest.fn().mockReturnValue(mockCoreYamlDoc) },
load: jest.fn().mockReturnValue(mockCoreYamlDoc),
}));
Comment on lines +63 to +75
const buildMockApp = () => {
const routes = {};
return { get: (path, handler) => { routes[path] = handler; }, _routes: routes };
};

const callSpecRoute = (app) => {
const handler = app._routes['/api/spec.json'];
if (!handler) throw new Error('/api/spec.json route not registered');
let spec = null;
const res = { json: (body) => { spec = body; } };
handler({}, res);
return spec;
};
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.

feat(openapi): add bearerAuth description + apiKeyAuth alias + schema descriptions

2 participants