APR-191: Add OpenAPI direct discovery path, remove UTCP Tool[] from core pipeline#41
Open
JacobSampson wants to merge 1 commit into
Open
APR-191: Add OpenAPI direct discovery path, remove UTCP Tool[] from core pipeline#41JacobSampson wants to merge 1 commit into
JacobSampson wants to merge 1 commit into
Conversation
… pipeline Introduces `DiscoveredOperation` as a unified pointer type that replaces UTCP's `Tool[]` across `buildClientToolMap`, `buildPublicTypeMap`, and `toClientTools`. All downstream schema resolution and type generation continues to read directly from the OpenAPI document. Key changes: - `openapi-discovery.ts` (new): walks `document.paths` and enumerates operations as `DiscoveredOperation[]` without UTCP. - `client-api.ts`: `buildClientToolMap` now accepts `DiscoveredOperation[]`; `getOperationContext` resolves by `op.path` directly instead of URL parsing. - `openapi.ts`: `buildPublicTypeMap` now accepts `DiscoveredOperation[]`. - `render.ts`: `toClientTools`, `renderProviderTypes`, `renderProviderGroupTypes`, `renderProviderTypesIndex` all accept `DiscoveredOperation[]`. - `docs/augment.ts`: `AugmentProviderDocsOptions` switches `tools` to `operations`, adds `publicTypeMap`; `buildOperationLookup` updated. - `utcp.ts`: exports `toolsToDiscoveredOperations` to convert UTCP output for the UTCP-success path. - `index.ts`: `generateRegistryTypes` and `augmentRegistryProviderDocs` try UTCP first; fall back to `discoverOperationsFromOpenApi` when UTCP returns empty. All 185 tests pass; lint clean. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
DiscoveredOperationas a unified pointer type replacing UTCP'sTool[]across all type-generation functions —buildClientToolMap,buildPublicTypeMap, andtoClientToolsdiscoverOperationsFromOpenApi()inopenapi-discovery.tsthat walksdocument.pathsdirectly without UTCP, fixing the ~80% of providers that currently fail UTCP conversiontoolsToDiscoveredOperations; when it fails or returns empty, the direct parser runs as fallbackChanges
packages/bundler/src/openapi-discovery.ts(new): definesDiscoveredOperationtype anddiscoverOperationsFromOpenApi()functionpackages/bundler/src/openapi-discovery.test.ts(new): 18 tests covering discovery, content-type selection, server base-path computation, and description/tag extractionpackages/bundler/src/client-api.ts:buildClientToolMapacceptsDiscoveredOperation[];getOperationContextresolves byop.pathkey directly instead of URL parsingpackages/bundler/src/openapi.ts:buildPublicTypeMapacceptsDiscoveredOperation[]; fixes pre-existinganycastpackages/bundler/src/render.ts:toClientTools,renderProviderTypes,renderProviderGroupTypes,renderProviderTypesIndexacceptDiscoveredOperation[]packages/bundler/src/docs/augment.ts:AugmentProviderDocsOptionsreplacestoolswithoperationsand addspublicTypeMappackages/bundler/src/utcp.ts: exportstoolsToDiscoveredOperationsadapterpackages/bundler/src/index.ts: bothgenerateRegistryTypesandaugmentRegistryProviderDocsuse UTCP-first with direct-discovery fallbackDiscoveredOperationfactory instead of UTCPToolfactoryTest Plan
pnpm test)eslint --max-warnings 0)openapi-discovery.tscovering all edge casesCloses: APR-191
🤖 Generated with Claude Code