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
Hi there,
We've been using Sway in our project, and during memory profiling, we've found the following line that's taking a lot of time (in lib/helper.js)
module.exports.validateAgainstSchema = function (validator, schema, value, schemaPath, isResponse, options) { schema = _.cloneDeep(schema); // Clone the schema as z-schema alters the provided document
I'm curious as to why z-schema alters the provided schema, could you provide an example where schema is modified? We are looking for a way to either improve deep clone performance or get rid of it
Thank you very much
The text was updated successfully, but these errors were encountered:
The reason is z-schema modifies the input document to keep track of what it has processed and what it hasn't: zaggino/z-schema#160 (comment) Not only does this cause problems as mentioned in the referenced issue, but I don't think it's right for anything sway does to modify inputs it's provided. Once I knew that z-schema modified the input document, I started cloning the input so that the original input was not modified in any form or fashion.
Hi there,
We've been using Sway in our project, and during memory profiling, we've found the following line that's taking a lot of time (in lib/helper.js)
module.exports.validateAgainstSchema = function (validator, schema, value, schemaPath, isResponse, options) {
schema = _.cloneDeep(schema); // Clone the schema as z-schema alters the provided document
I'm curious as to why z-schema alters the provided schema, could you provide an example where schema is modified? We are looking for a way to either improve deep clone performance or get rid of it
Thank you very much
The text was updated successfully, but these errors were encountered: