Closed Amenocy closed 5 years ago
Hello,
Could you explicit what you mean by "soft" model ? Also please provide a code example so I can understand better what you mean
currently sealed model throw error on set new attr, but soft sealed model doesn't throw an error and doesn't use new attr just ignore it. I want to use it in parse API data and ignore unwanted attributes.
I don't know what a "soft" model is, this word is not used anywhere in ObjectModel documentation
Sealed model constructors actually throw erros when you pass an object with an undeclared property, as shown in the official docs:
const Package = ObjectModel({
name: String,
config: { verbose: [Boolean] }
}, { sealed: true });
const Foo = new Package({ name: "foo", _id: 1 });
// > TypeError: property _id is not declared in the sealed model definition
sorry, it is a future request.
I'm sorry but I don't understand your issue, and you don't answer to my questions. Please provide more details, including a code example with the expected result. For now, I'm going to close this issue.
hi soft sealed models don't accept new attributes but if constructor object contains other attributes soft sealed object don't throw the error, just doesn't use new attributes.