Skip to content
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

Open
sbat opened this issue Nov 19, 2014 · 5 comments
Open

alamid-schema should copy the definition before modifying it #16

sbat opened this issue Nov 19, 2014 · 5 comments
Assignees

Comments

@sbat
Copy link
Member

sbat commented Nov 19, 2014

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.

@sbat sbat added the bug label Nov 19, 2014
@meaku meaku assigned flootr and unassigned meaku Jul 7, 2015
@flootr
Copy link

flootr commented Jul 13, 2015

Does 539fccb solve the problem?

@flootr
Copy link

flootr commented Aug 4, 2015

@sbat or @meaku ?

@meaku
Copy link
Member

meaku commented Aug 4, 2015

Jup.

@jhnns
Copy link
Member

jhnns commented Aug 14, 2015

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.

@jhnns
Copy link
Member

jhnns commented Aug 14, 2015

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.

@flootr flootr removed the bug label Sep 10, 2015
@flootr flootr assigned jhnns and unassigned flootr Dec 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants