-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alamid-schema should copy the definition before modifying it #16
Comments
Does 539fccb solve the problem? |
Jup. |
I'm still not happy with cloning the definition inside alamid-schema. Imho a developer must always expect an object to be modified if it is passed to another function. This could be noted in the README, if the schema is intended to be shared with Mongoose. |
It's clearly the application's decision to share the definition, so it's the application's responsibility to copy it. That's like the convention in C that memory is always freed by the function/module/class who allocated it. |
It seems like mongoose cannot handle the normalized schema definition (for example
type: "Array"
will produce an error like "string is not a function"). Currently the schema definition needs to be copied on the application's side before passing it to alamid-schema.The text was updated successfully, but these errors were encountered: