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
I am building out a custom model binding and am comparing objects to scope.schemaForm.schema object. I noticed when the model is initialized with defaults from the schema defaults, it's added to the model as a reference to the schema default object/array rather than copied. The result being, when a new object is being added to an array on the model and that array was created from the schema default, the schema object's default property will also include the new object.
Frankly I haven't dived into any of the validation code, but if it's basing any validation on the schema object that seems like an issue. Perhaps not, since I can't really see a reason to care about defaults when validating, but for my purpose, I'm comparing the object to the defaults to determine if I should consider the object for removal from the model (when the contained target property from the field input is empty string/null and the containing object is empty and not contained in the default).
I first thought I could just do a copy on the schema default from the builder, but seems like that object copy should happen when passsing the schema default value to sfSelect in the schemaForm directive (the line specifically: sfSelect(path, scope.model, prop['default']);). Otherwise, if I have nested objects in my schema each with a default of it's own, I end up with a schema default object with properties not originally defined in the schema.
The text was updated successfully, but these errors were encountered:
I never saw any end in sight to all these updates needed. Doesn't appear they do very many publishes either. So I just work on a manually modified version of the library to address this myself and prevent bower from updating the library unless I do so manually to readdress my modifications.
I am building out a custom model binding and am comparing objects to scope.schemaForm.schema object. I noticed when the model is initialized with defaults from the schema defaults, it's added to the model as a reference to the schema default object/array rather than copied. The result being, when a new object is being added to an array on the model and that array was created from the schema default, the schema object's default property will also include the new object.
Frankly I haven't dived into any of the validation code, but if it's basing any validation on the schema object that seems like an issue. Perhaps not, since I can't really see a reason to care about defaults when validating, but for my purpose, I'm comparing the object to the defaults to determine if I should consider the object for removal from the model (when the contained target property from the field input is empty string/null and the containing object is empty and not contained in the default).
I first thought I could just do a copy on the schema default from the builder, but seems like that object copy should happen when passsing the schema default value to sfSelect in the schemaForm directive (the line specifically:
sfSelect(path, scope.model, prop['default']);
). Otherwise, if I have nested objects in my schema each with a default of it's own, I end up with a schema default object with properties not originally defined in the schema.The text was updated successfully, but these errors were encountered: