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
following problem...
I have existing (dynamic) JSON schema's coming from the backend. Sometimes I want to use them directly, sometimes enrich them with frontend only types created by typebox.
So something like that
const S = Type.Object(connector.configurationSchema)
const T = Type.Object({
connectionName: Type.String(),
})
const CompleteSchema = Type.Intersect([S, T])
While that works great with avj, I can't use some of the typebox helpers.
E.g. Value.Create(CompleteSchema) fails with
Error: Unknown type
at Visit4 (@sinclair_typebox_value.js?v=9bc4dcdb:1856:15)
at FromObject3 (@sinclair_typebox_value.js?v=9bc4dcdb:1642:18)
at Visit4 (@sinclair_typebox_value.js?v=9bc4dcdb:1825:14)
at @sinclair_typebox_value.js?v=9bc4dcdb:1580:20
at Array.reduce (<anonymous>)
at FromIntersect3 (@sinclair_typebox_value.js?v=9bc4dcdb:1579:32)
at Visit4 (@sinclair_typebox_value.js?v=9bc4dcdb:1811:14)
at Function.Create2 (@sinclair_typebox_value.js?v=9bc4dcdb:1864:57)
at Object.Create3 (@sinclair_typebox_value.js?v=9bc4dcdb:3263:18)
I guess it is because the json-schema definitions from the backend don't have type symbols (like Symbol(TypeBox.Kind)).
Is there some utility method to convert a 'external' schema definition into a 'typebox' one ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey there,
following problem...
I have existing (dynamic) JSON schema's coming from the backend. Sometimes I want to use them directly, sometimes enrich them with frontend only types created by
typebox
.So something like that
While that works great with
avj
, I can't use some of thetypebox
helpers.E.g.
Value.Create(CompleteSchema)
fails withI guess it is because the json-schema definitions from the backend don't have type symbols (like
Symbol(TypeBox.Kind)
).Is there some utility method to convert a 'external' schema definition into a 'typebox' one ?
Beta Was this translation helpful? Give feedback.
All reactions