Jsonifiable schemas work
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
11
src/tests.ts
11
src/tests.ts
@@ -1,8 +1,7 @@
|
||||
import { pipeInto } from "ts-functional-pipe"
|
||||
import { z } from "zod"
|
||||
import { extendSchemableClass, makeSchemableClass, newSchemable } from "."
|
||||
import { dejsonifySchemable, makeJsonifiableSchemableClass } from "./jsonifiable"
|
||||
import { dejsonifyBigIntSchema, jsonifyBigIntSchema } from "./legacy/jsonifiable"
|
||||
import { dejsonifyBigIntSchema, dejsonifySchemable, jsonifyBigIntSchema, makeJsonifiableSchemableClass } from "./jsonifiable"
|
||||
|
||||
|
||||
const UserLevel = z.enum(["User", "Admin"])
|
||||
@@ -10,9 +9,9 @@ const UserLevel = z.enum(["User", "Admin"])
|
||||
|
||||
const UserProto = makeSchemableClass({
|
||||
schema: z.object({
|
||||
id: z.bigint(),
|
||||
name: z.string(),
|
||||
level: UserLevel,
|
||||
id: z.bigint(),
|
||||
name: z.string(),
|
||||
level: UserLevel,
|
||||
}),
|
||||
|
||||
defaultValues: {
|
||||
@@ -44,7 +43,7 @@ class User extends pipeInto(
|
||||
dejsonifySchema: ({ schema, shape }) => schema.extend({
|
||||
id: dejsonifyBigIntSchema(shape.id)
|
||||
}),
|
||||
})
|
||||
}),
|
||||
) {}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user