How to ref a schema that was not defined by typebox? #3360
Unanswered
OmarAlkadri
asked this question in
Q&A
Replies: 2 comments 1 reply
-
@daffl @marshallswain @vonagam @FossPrime @ekryski @DaddyWarbucks Hello, we have been using feathersjs for a long time and now we want to move to feathersjs V 5, but I am now creating an experiment project and I am facing a lot of problems. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Recursive schemas in TypeBox should be possible like this: export const usersSchema = Type.Object(
{
_id: ObjectIdSchema(),
email: Type.String(),
date: Type.String({ format: 'date' }),
password: Type.Optional(Type.String()),
userID: ObjectIdSchema(),
user: Type.Ref(() => usersSchema),
},
{ $id: 'Users', additionalProperties: false }
) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
How can I create a userID whose reference is the same as users
i use feathersjs V5 and typeBox
export const usersSchema = Type.Object(
{
_id: ObjectIdSchema(),
email: Type.String(),
date: Type.String({ format: 'date' }),
password: Type.Optional(Type.String()),
userID: ObjectIdSchema(),
user: Type.Ref(usersSchema),
},
{ $id: 'Users', additionalProperties: false }
)
Block-scoped variable 'usersSchema' used before its declaration.ts(2448)
users.schema.ts(13, 14): 'usersSchema' is declared here.
Beta Was this translation helpful? Give feedback.
All reactions