MCPcopy Create free account
hub / github.com/middleapi/orpc / customOpenAPIOperation

Function customOpenAPIOperation

packages/openapi/src/openapi-custom.ts:15–25  ·  view source on GitHub ↗
(o: T, extend: OverrideOperationValue)

Source from the content-addressed store, hash-verified

13 * @see {@link https://orpc.dev/docs/openapi/openapi-specification#customizing-operation-objects Customizing Operation Objects Docs}
14 */
15export function customOpenAPIOperation<T extends object>(o: T, extend: OverrideOperationValue): T {
16 return new Proxy(o, {
17 get(target, prop, receiver) {
18 if (prop === OPERATION_EXTENDER_SYMBOL) {
19 return extend
20 }
21
22 return Reflect.get(target, prop, receiver)
23 },
24 })
25}
26
27export function getCustomOpenAPIOperation(o: object): OverrideOperationValue | undefined {
28 return (o as any)[OPERATION_EXTENDER_SYMBOL] as OverrideOperationValue | undefined

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected