Skip to content

feat: add OpenAPI-first discovery tooling#235

Open
brendanjryan wants to merge 16 commits intomainfrom
brendanjryan/discovery-openapi-consolidation
Open

feat: add OpenAPI-first discovery tooling#235
brendanjryan wants to merge 16 commits intomainfrom
brendanjryan/discovery-openapi-consolidation

Conversation

@brendanjryan
Copy link
Collaborator

@brendanjryan brendanjryan commented Mar 24, 2026

Summary

  • add a new mppx/discovery module with OpenAPI generation and validation helpers
  • add framework discovery() helpers for Hono, Express, and Next.js
  • make mppx/proxy OpenAPI-first with /openapi.json, keep /llms.txt, and rm legacy /discover*
  • add mppx discover validate <url-or-file> to the CLI

Details

  • ports the useful discovery pieces from feat: service discovery tooling (OpenAPI + x-payment-info + x-service-info) #178 onto current main
  • keeps handler-derived route discovery as the preferred path while preserving legacy route config support in the generator
  • makes public discovery output spec-strict for charge and session
  • enriches proxy service metadata with categories and structured docs links for x-service-info
  • updates discovery-related tests, package exports, and spec references

Validation

npx tsx src/bin.ts discover validate https://stablephone.dev/openapi.json

Breaking change

  • mppx/proxy no longer serves /discover* as a discovery API surface
  • /openapi.json is the canonical machine-readable contract and /llms.txt is the text-friendly derivative

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/mppx@235

commit: 2fe8855

@brendanjryan brendanjryan requested review from jxom and tmm and removed request for tmm March 25, 2026 01:11
- Remove /discover* → 410 Gone shim from proxy (dead paths now 404)
- Remove dead serialize(), toServicesMarkdown(), toMarkdown(), pushRoutes()
- Use z.looseObject() throughout Discovery schemas so x-* extensions and
  extra OpenAPI fields (parameters, tags, operationId, etc.) pass through
Proxy pre-generates openapi.json and llms.txt at create() time.
Framework helpers (Express, Hono, Next.js) cache after first request
via lazy init (preserves dynamic import for code-splitting).
Switched docs.llms to relative path so the document is fully static.
…static imports, typed handlers, elysia discovery

1. Proxy buildDiscoveryRoutes() passes through full paymentOf() output
   instead of hand-picking fields (preserves unitType, recipient, etc.)
2. Collapsed docsLlmsUrl callback to docs.llms string — removed
   resolveLlmsUrl/resolveLlmsLink dead code, kept input compat
3. Replaced dynamic await import() with static imports in Express/Hono/
   Next.js helpers; Express + Next.js precompute at registration time
4. Exported DiscoverableHandler type, updated Wrap to expose _internal
   metadata — removed as any casts from tests
5. Added Elysia discovery() helper for framework parity
…method keys

1. docs.llms (and all ServiceDocs links) now accept relative paths
   like /llms.txt — fixes validator rejecting proxy-generated docs
2. Paths modeled as PathItem with explicit get/post/put/etc keys
   instead of record<string, operation> — path-item-level fields
   like summary, parameters, x-extensions no longer cause errors
3. Validator iterates only HTTP method keys, skipping path-item fields
The IIFE pattern swallowed c.error() exit codes because the
return value was checked as typeof !== 'string' instead of
propagating the error. Refactored to flat if/else.
@brendanjryan brendanjryan force-pushed the brendanjryan/discovery-openapi-consolidation branch from de3e4fb to 0dfbeb9 Compare March 25, 2026 04:06
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.

1 participant