Show descriptions for public/free endpoints on server pages - #1030
Merged
Conversation
Free resources (siwx/public/apiKey) have no 402 response, and the Resources list sourced descriptions exclusively from the parsed 402 body — so catalog rows always rendered an empty description, with no way for merchants to set one. The discovery package already folds each openapi operation's summary ?? description into endpoint.summary; fetch-discovery simply dropped it. Now: - fetch-discovery maps it into DiscoveredResource.description, filtering the package's 'METHOD /path' placeholder - registration stores it in Resource.metadata alongside the existing free-row fields (authMode, pricingMode, price); paid rows store it too via the same metadata merge - the resource Header falls back to metadata.description (cleaned via cleanExternalText) when the 402 body has no description, clamped to two lines Existing rows pick the description up on their next (re-)registration.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
External origins control the description text — cap what registration persists into Resource.metadata at 500 chars. Also reverts two files that a repo-wide format pass reflowed without any code change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Merchant report: free catalog endpoints (
security: []public, apiKey, SIWX) show no description in the Resources list, and there's no way to set one. Paid endpoints get theirs from the 402 response'saccepts[].description/resource.description.Root cause
Free resources have no 402 response —
listOriginsWithResourcesreturnsdata: {}for them, sogetDescription()always came back empty. The description was being dropped at the very start of the chain:@agentcash/discoveryalready folds each openapi operation'ssummary ?? descriptionintoendpoint.summary, butfetchDiscoveryDocumentnever mapped it intoDiscoveredResource, so registration never saw it.Fix
fetch-discoverymaps the discovery summary intoDiscoveredResource.description, dropping the package's"METHOD /path"placeholder (emitted when the merchant set neither summary nor description — noise next to the route itself) and capping at 500 chars (external origins control this text).Resource.metadata.description, following the existing free-row metadata pattern (authMode,pricingMode,price) — no schema migration. Paid rows store it too via the same metadata merge, as a display fallback.Headerrenders the 402-body description first, falling back tometadata.description(cleaned withcleanExternalText, clamped to two lines). Empty-string 402 descriptions also fall through.Merchants set it in their openapi spec: operation
summary(preferred) ordescription. Existing rows pick it up on the next (re-)registration of the origin.Known limitation (matches existing
pricingMode/pricemerge semantics): removing the text from the spec doesn't clear a previously stored value on re-register.Verification
register-origin.test.ts(written failing-first) asserting descriptions flow intoregisterFreeResource(public + siwx) andregisterResource(paid) options.endpoint-description.test.tscovering placeholder filtering and the 500-char cap.npx vitest run: 193 passed (16 files).pnpm format && pnpm lint && pnpm check: clean.