@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
49 lines (44 loc) • 1.27 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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
/**
* A single field-level or parameter-level validation error.
*/
export type ValidationError = {
/**
* A machine-readable error code identifying the specific validation failure.
*/
code: string;
/**
* A human-readable description of the validation error.
*/
message: string;
/**
* The name of the field, parameter, or path segment that caused the error.
*/
target?: string | undefined;
};
/** @internal */
export const ValidationError$inboundSchema: z.ZodType<
ValidationError,
z.ZodTypeDef,
unknown
> = z.object({
code: types.string(),
message: types.string(),
target: types.optional(types.string()),
});
export function validationErrorFromJSON(
jsonString: string,
): SafeParseResult<ValidationError, SDKValidationError> {
return safeParse(
jsonString,
(x) => ValidationError$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ValidationError' from JSON`,
);
}