You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The solution offered unfortunately won't work in the context of feathers since none of the other functions like the TReference type produced for schema.
For example getValidator wants schema: schema: TObject<TProperties> | TIntersect<TObject<TProperties>[]> | TUnion<TObject<TProperties>[]>
Is there any other suggested way of defining references to other schemas that reference each other that will work?
Reference to my definitions as mentioned in the post above:
// NOTE: these schemas are defined in different files and are displayed here as is for reference, thus I'm not getting errors like:
// Block-scoped variable 'accountSchema' used before its declaration.ts
const userSchema = Type.Object(
{
id: Type.String({ format: 'uuid' }),
email: Type.String({ format: 'email' }),
account: Type.Ref(accountSchema)
},
{ $id: 'User', additionalProperties: false }
)
const accountSchema = Type.Object(
{
id: Type.String({ format: 'uuid' }),
name: Type.String(),
users: Type.Array(Type.Ref(userSchema)),
locations: Type.Array(Type.Ref(locationSchema))
},
{ $id: 'Account', additionalProperties: false }
)
The provided solution that does not solve the issue for me in feathers:
It seems to me like the most simple solution here is just to use JSON Schema instead, as it doesn't give any errors when doing the same circular relations.
Any opinions, as I know TypeBox is the preferred option?
Doesn't TypeBox just compile to JSON Schema anyway?
Activity
EmileSpecs commentedon Apr 23, 2024
It seems to me like the most simple solution here is just to use JSON Schema instead, as it doesn't give any errors when doing the same circular relations.
Any opinions, as I know TypeBox is the preferred option?
Doesn't TypeBox just compile to JSON Schema anyway?