/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
HunkRep,
HunkRep$inboundSchema,
HunkRep$Outbound,
HunkRep$outboundSchema,
} from "./hunkrep.js";
export type ReferenceRep = {
/**
* File path of the reference
*/
path: string;
/**
* Programming language used in the file
*/
hint?: string | undefined;
hunks: Array<HunkRep>;
};
/** @internal */
export const ReferenceRep$inboundSchema: z.ZodType<
ReferenceRep,
z.ZodTypeDef,
unknown
> = z.object({
path: z.string(),
hint: z.string().optional(),
hunks: z.array(HunkRep$inboundSchema),
});
/** @internal */
export type ReferenceRep$Outbound = {
path: string;
hint?: string | undefined;
hunks: Array<HunkRep$Outbound>;
};
/** @internal */
export const ReferenceRep$outboundSchema: z.ZodType<
ReferenceRep$Outbound,
z.ZodTypeDef,
ReferenceRep
> = z.object({
path: z.string(),
hint: z.string().optional(),
hunks: z.array(HunkRep$outboundSchema),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace ReferenceRep$ {
/** @deprecated use `ReferenceRep$inboundSchema` instead. */
export const inboundSchema = ReferenceRep$inboundSchema;
/** @deprecated use `ReferenceRep$outboundSchema` instead. */
export const outboundSchema = ReferenceRep$outboundSchema;
/** @deprecated use `ReferenceRep$Outbound` instead. */
export type Outbound = ReferenceRep$Outbound;
}
export function referenceRepToJSON(referenceRep: ReferenceRep): string {
return JSON.stringify(ReferenceRep$outboundSchema.parse(referenceRep));
}
export function referenceRepFromJSON(
jsonString: string,
): SafeParseResult<ReferenceRep, SDKValidationError> {
return safeParse(
jsonString,
(x) => ReferenceRep$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ReferenceRep' from JSON`,
);
}