api
Type Aliases
AnyPaths
AnyPaths =
object
Defined in: api.ts:11
Base type for OpenAPI paths - accepts any object structure.
DefineOperations
DefineOperations<
T> ={ [K in keyof T]: OperationEntry }
Defined in: api.ts:36
Define the operations structure for type-safe API bindings. Transforms an operations interface (from openapi-typescript) into a mapped type with proper index signature for TypeScript compatibility.
Type Parameters
T
T extends object = OperationMap
The operations interface from openapi-typescript
OperationBindings
OperationBindings<
Paths,Operations> =Record<keyofOperations, {method:HttpMethod;path:Extract<keyofPaths,string>; }>
Defined in: api.ts:53
Maps operation names to their HTTP method and path. Used by plugins to define how friendly operation names map to OpenAPI paths.
Type Parameters
Paths
Paths
The paths interface from openapi-typescript
Operations
Operations extends OperationMap
The operations interface from openapi-typescript
Example
OperationEntry
OperationEntry =
object
Defined in: api.ts:17
Structure of an OpenAPI operation (endpoint). Matches the shape generated by openapi-typescript.
Properties
parameters?
optionalparameters:Record<string,any>
Defined in: api.ts:18
requestBody?
optionalrequestBody:Record<string,any>
Defined in: api.ts:19
responses
responses:
Record<string|number,any>
Defined in: api.ts:20
OperationMap
OperationMap<
T> =TextendsRecord<string,OperationEntry> ?T:any
Defined in: api.ts:27
Type constraint for a map of operation names to their definitions. Used internally to validate operation structures.
Type Parameters
T
T = any
Functions
createOperationBindingsFactory()
createOperationBindingsFactory<
Paths,Ops>(): <T>(ops) =>T
Defined in: api.ts:75
Creates a type-safe factory for defining operation bindings. The factory validates that each operation's method and path are valid for the given OpenAPI spec.
Type Parameters
Paths
Paths extends object
The paths interface from openapi-typescript
Ops
Ops extends unknown
The operations interface from openapi-typescript
Returns
A factory function that validates and returns the operation bindings
<
T>(ops):T
Type Parameters
T
T extends Record<keyof Ops, { method: HttpMethod; path: any; }>
Parameters
ops
T & { [K in string | number | symbol]: T[K] extends { method: M; path: P } ? M extends HttpMethod ? P extends PathsWithMethod<Paths, M<M>> ? { method: M<M>; path: P<P> } : never : never : never }
Returns
T