Skip to content

@W-23748894 feat(webhooks): render OAS 3.1/3.2 top-level webhooks in a dedicated section - #82

Merged
alexpmule merged 6 commits into
mainfrom
W-23748894-webhooks
Aug 20, 2026
Merged

@W-23748894 feat(webhooks): render OAS 3.1/3.2 top-level webhooks in a dedicated section#82
alexpmule merged 6 commits into
mainfrom
W-23748894-webhooks

Conversation

@alexpmule

@alexpmule alexpmule commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

@W-23748894

What

Renders OAS 3.1/3.2 top-level webhooks as first-class documentation.

Part of the webhooks feature for TD-0333486. Depends on @api-components/amf-helper-mixin >= 4.5.38 (published), which resolves top-level apiContract#webhooks via an additive fallback.

Per-repo behavior:

  • api-navigation — dedicated "Webhooks" nav section.
  • api-method-documentation — shows the webhook event name instead of a URL.
  • api-documentation — suppresses the per-operation Try-It for webhooks (webhooks are event-driven; there is nothing to invoke).

Why

Webhooks are top-level in OAS 3.1/3.2 (not under paths). AC4: webhooks must render as their own first-class section with Try-It suppressed.

Dependency / publish gate

The resolver (_computeWebhooks + the apiContract#webhooks namespace key) ships in amf-helper-mixin 4.5.38 (now published). This PR raises the peer floor to ^4.5.38 and regenerates the lockfile so CI installs it. Below 4.5.38 the resolver does not exist and the feature silently no-ops with no error/log/metric.

Tests

Green in chromium + firefox. Inline AMF expanded-model fixtures. Webhooks suite verified green against the real published mixin 4.5.38 (6/6).

Known QA notes (P2, non-blocking, tracked for the PR discussion)

  • AC-03 is proven in two halves (mixin suite proves resolution on 4.5.38 source; this suite proves suppression on the installed mixin) — no single end-to-end select→resolve→render→no-Try-It test, and no .action DOM-absence assertion.
  • No test consumes the real generated model; a future generator change to the apiContract#webhooks predicate would pass GREEN and break prod. A smoke test against a real compact model (at least in nav) is recommended.

Result tested:

Screenshot 2026-08-20 at 10 08 07 AM

@alexpmule
alexpmule force-pushed the W-23748894-webhooks branch 2 times, most recently from 1176ee4 to 8c9af67 Compare August 19, 2026 18:28
alexpmule and others added 2 commits August 19, 2026 21:40
…section

Top-level webhooks (OAS 3.1/3.2) now render in their own "Webhooks" nav
section, sibling to "Endpoints". A webhook compiles to an apiContract#EndPoint
node identical to a regular endpoint; the only distinction is the WebAPI root
references it via apiContract#webhooks. _traverseWebhooks routes those nodes
into a distinct `webhooks` collection via a collectionKey param on
_appendEndpointItem, so they never leak into the Endpoints list. The label
defaults to the event name (path, renderPath=false) since a webhook has no
core#name. Query filtering is shared with endpoints via _filterEndpointItems.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…olver

The top-level webhooks resolver (_computeWebhooks + apiContract#webhooks
namespace key) ships in amf-helper-mixin 4.5.38. Below that floor the
webhooks collection resolves empty and the feature silently no-ops.
Regenerate the lockfile so CI installs 4.5.38.
@alexpmule
alexpmule force-pushed the W-23748894-webhooks branch from 8c9af67 to 9d411c3 Compare August 20, 2026 00:47
TypeScript checkJs infers instance properties from `this.x =`
assignments in the .js, not from the .d.ts. webhooksOpened was only
ever read (never assigned), so tsc reported ts(2339) 'Property
webhooksOpened does not exist on type ApiNavigation' at the template
usages. Initialize it to false alongside the other boolean flags,
matching endpointsOpened.
The demo had no API exercising top-level webhooks, so the Webhooks nav
section was never visible when previewing the component. Add the OAS 3.1
webhooks fixture (reused from api-type-document) as a selectable demo
API, whitelisting the generated models in .gitignore like grpc-test.

Also add a smoke test that loads the generated model (compact + full)
and asserts the Webhooks section renders — closing the P2 gap where no
test consumed the real generated `apiContract#webhooks` predicate.
@alexpmule
alexpmule marked this pull request as ready for review August 20, 2026 13:09
@alexpmule alexpmule self-assigned this Aug 20, 2026
alexpmule and others added 2 commits August 20, 2026 12:48
…nerator to 0.4.0

Bump @api-components/api-model-generator ^0.2.14 -> ^0.4.0 so the demo/test
models are generated from the in-repo OAS 3.1 spec (amf-client-js 5.11 supports
OAS 3.1/3.2; 4.7.x did not). Rework test/webhooks.test.js to load the generated
oas31-webhooks model via AmfLoader instead of hand-building AMF inline. Add
@graph-aware expansion to test/amf-loader.js (amf-client-js 5.11 emits flattened
@graph models). Stop committing the generated model: drop the .gitignore
whitelist and untrack demo/oas31-webhooks(.compact).json (now prepare artifacts).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alexpmule
alexpmule merged commit 26bbfe8 into main Aug 20, 2026
3 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.

2 participants