Closed imthenachoman closed 5 years ago
Thank you! 🎉
Yes, it was definitely an error, thank you for pointing it out!
What happens if a data type in the object does not match the schema?
The template that SJS build is made specifically for the data type that has to be inserted.
E.g.
const schema = { a: 'string', b: 'number' };
// output template => [{ "a":" ] x1 [", "b": ] x2 [ } ]
Where you insert the values at x
positions.
So, it's very important that the data type matches the schema.
Initially, I designed like that for maximum performance. However, I have to check how much a data type check could have an impact on performance.
Can you modify the schema after the sjs has been initialized/created?
There is no built-in feature for that. The template creation is not meant to be a repeated operation. So, it is not optimized for performance. You can however simply compile another schema.
Thank you!
First, great job. I love the idea of using a schema. Very clever.
In the Defining schema with nested objects example, the schema has
e
as anumber
but the data passed is not a number.A few questions/points:
sjs
has been initialized/created?