[FIX] correct the API generation

This commit is contained in:
Edouard DUPIN 2024-09-14 10:22:51 +02:00
parent dde514a1a0
commit 1271885124
5 changed files with 4 additions and 109 deletions

View File

@ -8,7 +8,7 @@ export * from "./generic-data"
export * from "./generic-data-soft-delete"
export * from "./generic-timing"
export * from "./health-result"
export * from "./int"
export * from "./integer"
export * from "./iso-date"
export * from "./local-date"
export * from "./long"

View File

@ -1,36 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
export const Zodint = zod.object({
});
export type int = zod.infer<typeof Zodint>;
export function isint(data: any): data is int {
try {
Zodint.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='Zodint' error=${e}`);
return false;
}
}
export const ZodintWrite = zod.object({
});
export type intWrite = zod.infer<typeof ZodintWrite>;
export function isintWrite(data: any): data is intWrite {
try {
ZodintWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodintWrite' error=${e}`);
return false;
}
}

View File

@ -4,33 +4,5 @@
import { z as zod } from "zod";
export const ZodInteger = zod.object({
});
export const ZodInteger = zod.number().safe();
export type Integer = zod.infer<typeof ZodInteger>;
export function isInteger(data: any): data is Integer {
try {
ZodInteger.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodInteger' error=${e}`);
return false;
}
}
export const ZodIntegerWrite = zod.object({
});
export type IntegerWrite = zod.infer<typeof ZodIntegerWrite>;
export function isIntegerWrite(data: any): data is IntegerWrite {
try {
ZodIntegerWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodIntegerWrite' error=${e}`);
return false;
}
}

View File

@ -4,14 +4,14 @@
import { z as zod } from "zod";
import {ZodUUID} from "./uuid";
import {Zodint, ZodintWrite } from "./int";
import {ZodInteger} from "./integer";
export const ZodRestErrorResponse = zod.object({
uuid: ZodUUID.optional(),
name: zod.string(),
message: zod.string(),
time: zod.string(),
status: Zodint,
status: ZodInteger,
statusMessage: zod.string(),
});

View File

@ -1,41 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodLong} from "./long";
export const ZodUserOut = zod.object({
id: ZodLong,
login: zod.string().max(255).optional(),
});
export type UserOut = zod.infer<typeof ZodUserOut>;
export function isUserOut(data: any): data is UserOut {
try {
ZodUserOut.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodUserOut' error=${e}`);
return false;
}
}
export const ZodUserOutWrite = zod.object({
id: ZodLong,
login: zod.string().max(255).nullable().optional(),
});
export type UserOutWrite = zod.infer<typeof ZodUserOutWrite>;
export function isUserOutWrite(data: any): data is UserOutWrite {
try {
ZodUserOutWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodUserOutWrite' error=${e}`);
return false;
}
}