flagconfigevaluation.ts•2 kB
/*
* 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";
export type FlagConfigEvaluation = {
contextKinds?: Array<string> | undefined;
};
/** @internal */
export const FlagConfigEvaluation$inboundSchema: z.ZodType<
FlagConfigEvaluation,
z.ZodTypeDef,
unknown
> = z.object({
contextKinds: z.array(z.string()).optional(),
});
/** @internal */
export type FlagConfigEvaluation$Outbound = {
contextKinds?: Array<string> | undefined;
};
/** @internal */
export const FlagConfigEvaluation$outboundSchema: z.ZodType<
FlagConfigEvaluation$Outbound,
z.ZodTypeDef,
FlagConfigEvaluation
> = z.object({
contextKinds: z.array(z.string()).optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace FlagConfigEvaluation$ {
/** @deprecated use `FlagConfigEvaluation$inboundSchema` instead. */
export const inboundSchema = FlagConfigEvaluation$inboundSchema;
/** @deprecated use `FlagConfigEvaluation$outboundSchema` instead. */
export const outboundSchema = FlagConfigEvaluation$outboundSchema;
/** @deprecated use `FlagConfigEvaluation$Outbound` instead. */
export type Outbound = FlagConfigEvaluation$Outbound;
}
export function flagConfigEvaluationToJSON(
flagConfigEvaluation: FlagConfigEvaluation,
): string {
return JSON.stringify(
FlagConfigEvaluation$outboundSchema.parse(flagConfigEvaluation),
);
}
export function flagConfigEvaluationFromJSON(
jsonString: string,
): SafeParseResult<FlagConfigEvaluation, SDKValidationError> {
return safeParse(
jsonString,
(x) => FlagConfigEvaluation$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'FlagConfigEvaluation' from JSON`,
);
}