44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
/**
|
|
* Interface of the server (auto-generated code)
|
|
*/
|
|
import { z as zod } from "zod";
|
|
|
|
import {ZodUUID} from "./uuid";
|
|
import {Zodint} from "./int";
|
|
|
|
export const ZodRestErrorResponse = zod.object({
|
|
uuid: ZodUUID.optional(),
|
|
name: zod.string(),
|
|
message: zod.string(),
|
|
time: zod.string(),
|
|
status: Zodint,
|
|
statusMessage: zod.string(),
|
|
|
|
});
|
|
|
|
export type RestErrorResponse = zod.infer<typeof ZodRestErrorResponse>;
|
|
|
|
export function isRestErrorResponse(data: any): data is RestErrorResponse {
|
|
try {
|
|
ZodRestErrorResponse.parse(data);
|
|
return true;
|
|
} catch (e: any) {
|
|
console.log(`Fail to parse data type='ZodRestErrorResponse' error=${e}`);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
export const ZodRestErrorResponseWrite = ZodRestErrorResponse.partial();
|
|
|
|
export type RestErrorResponseWrite = zod.infer<typeof ZodRestErrorResponseWrite>;
|
|
|
|
export function isRestErrorResponseWrite(data: any): data is RestErrorResponseWrite {
|
|
try {
|
|
ZodRestErrorResponseWrite.parse(data);
|
|
return true;
|
|
} catch (e: any) {
|
|
console.log(`Fail to parse data type='ZodRestErrorResponseWrite' error=${e}`);
|
|
return false;
|
|
}
|
|
}
|