-
Notifications
You must be signed in to change notification settings - Fork 0
A7: URL-path method fallback for raw fetch (closes #79) #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4920bbc
fe16e41
24ed60e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,18 @@ export type Language = | |
| | "rust"; | ||
|
|
||
| export interface MethodFingerprint { | ||
| /** SDK method chain pattern, e.g. "chat.completions.create" */ | ||
| pattern: string; | ||
| /** | ||
| * SDK method chain pattern, e.g. "chat.completions.create". | ||
| * Either `pattern` or `urlPathKey` must be set on every entry. | ||
| */ | ||
| pattern?: string; | ||
| /** | ||
| * URL-path substring used by `lookupByUrlPath` when an API call has a known | ||
| * provider but no SDK method chain (e.g. raw `fetch(...)`). The matcher tries | ||
| * the longest `urlPathKey` first; the special value `"_default"` is a | ||
| * provider-wide fallback (A7, issue #79). | ||
| */ | ||
| urlPathKey?: string; | ||
|
Comment on lines
+12
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win Encode the
Proposed type-safe shape-export interface MethodFingerprint {
+type MethodFingerprintKey =
+ | { pattern: string; urlPathKey?: string }
+ | { pattern?: string; urlPathKey: string };
+
+export type MethodFingerprint = MethodFingerprintKey & {
/**
* SDK method chain pattern, e.g. "chat.completions.create".
* Either `pattern` or `urlPathKey` must be set on every entry.
*/
- pattern?: string;
+ pattern?: string;
/**
* URL-path substring used by `lookupByUrlPath` when an API call has a known
* provider but no SDK method chain (e.g. raw `fetch(...)`). The matcher tries
* the longest `urlPathKey` first; the special value `"_default"` is a
* provider-wide fallback (A7, issue `#79`).
*/
urlPathKey?: string;
/** HTTP verb: GET | POST | PUT | PATCH | DELETE | SUBSCRIBE | RPC */
httpMethod: string;
/** Full URL or URL template for the mapped endpoint */
endpoint: string;
costModel: CostModel;
...
-}
+};🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Skipping. The runtime validator in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
✏️ Learnings added
|
||
| /** HTTP verb: GET | POST | PUT | PATCH | DELETE | SUBSCRIBE | RPC */ | ||
| httpMethod: string; | ||
| /** Full URL or URL template for the mapped endpoint */ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.