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
When transfer joi definition from server, then JSON.parse as below:
// after a fetch from REST API
jsonFromServer.email === {"isJoi":true,"_type":"string","_settings":null,"_valids":{"_set":[]},"_invalids":{"_set":[""]},"_tests":[],"_refs":[],"_flags":{"presence":"required"},"_description":null,"_unit":null,"_notes":[],"_tags":[],"_examples":[],"_meta":[],"_inner":{}}
var emailType = joi.compile(jsonFromServer.email)
joi.attempt('abc', emailType)
// above line will throw error
The throwed error is:
TypeError: schema._validateWithOptions is not a function
Seems the joi type schema cannot be transferred from remote, then convert using this lib?
Or there's something more usage I'm missing?
The text was updated successfully, but these errors were encountered:
futurist
changed the title
TypeError: schema._validateWithOptions is not a function
After transfer from server, throw error: TypeError: schema._validateWithOptions is not a function
Feb 17, 2017
Joi objects are not serializable, you'd be missing the prototype. You have to have joi itself as well as the schemas on the client side. Maybe someday...
When transfer
joi
definition from server, thenJSON.parse
as below:The throwed error is:
Seems the joi type schema cannot be transferred from remote, then convert using this lib?
Or there's something more usage I'm missing?
The text was updated successfully, but these errors were encountered: