@mintlify/common
Version:
Commonly shared code within Mintlify
18 lines (17 loc) • 804 B
TypeScript
/**
* Look up an OpenAPI path from a `paths` or `webhooks` object, tolerating
* trailing-slash mismatches. Returns the spec's original key and path item.
*
* Exact matches always win: if the spec declares both `/users` and `/users/`,
* a reference to either resolves to the correctly keyed operation. Only when
* there is no exact match do we fall back to a canonicalized (trailing-slash
* insensitive) lookup.
*
* Typed loosely on purpose — the OpenAPI type definitions vary between v3 and
* v3.1 in ways that confuse generic constraints, but at this layer we only
* care about identifying the matching key/value pair.
*/
export declare function findOpenApiPath<T = unknown>(paths: Record<string, any> | undefined, endpoint: string): {
pathKey: string;
pathItem: T;
} | undefined;