UNPKG

@alexop/openapi-zod-client

Version:

[![Screenshot 2022-11-12 at 18 52 25](https://user-images.githubusercontent.com/47224540/201487856-ffc4c862-6f31-4de1-8ef1-3981fabf3416.png)](https://openapi-zod-client.vercel.app/)

17 lines (14 loc) 724 B
// taken from // https://github.dev/metadevpro/openapi3-ts/blob/a62ff445207af599f591532ef776e671c456cc37/src/model/OpenApi.ts#L261-L269 // to avoid the runtime dependency on `openapi3-ts` // which itself depends on `yaml` import (which use CJS `require` and thus can't be imported in a ESM module) import type { ReferenceObject } from "openapi3-ts"; /** * A type guard to check if the given value is a `ReferenceObject`. * See https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types * * @param obj The value to check. */ export function isReferenceObject(obj: any): obj is ReferenceObject { return obj != null && Object.prototype.hasOwnProperty.call(obj, "$ref"); }