@vercel/sdk
Version:
<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>
42 lines (37 loc) • 1.11 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../lib/schemas.js";
import { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { PropertyKey, PropertyKey$inboundSchema } from "./propertykey.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
/**
* Represents an error encountered while parsing a value to match the schema
*/
export type Issue = {
/**
* The path to the property where the issue occurred
*/
path: Array<PropertyKey>;
/**
* A descriptive message explaining the issue
*/
message: string;
};
/** @internal */
export const Issue$inboundSchema: z.ZodType<Issue, z.ZodTypeDef, unknown> = z
.object({
path: z.array(PropertyKey$inboundSchema),
message: types.string(),
});
export function issueFromJSON(
jsonString: string,
): SafeParseResult<Issue, SDKValidationError> {
return safeParse(
jsonString,
(x) => Issue$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Issue' from JSON`,
);
}