-
Notifications
You must be signed in to change notification settings - Fork 52
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
Mongoose Objects returning invalid json #60
Comments
@jontonsoup |
@tothandras ah, I was unclear in my original issue. I have an array of objects as defined like this in my schema:
The result ends up like this:
Which is returning invalid json. Best, |
@jontonsoup Currently graffiti-mongoose is not creating |
Ah okay -- to clarify. Do you mean a new mongoose schema or a new graphql type / is there an example online somewhere? Thanks! |
The library should handle it with defining new GraphQL type. :) In the meantime you can define new mongoose schema and use object references. |
@tothandras awesome! Thanks. |
@tothandras would a better solution be to escape the json? This problem is giving me a huge headache in properly parsing the nested json. |
@jontonsoup you can open a PR if you find a nice solution:
|
That has actually held me up since November, but I've been running into silly corner cases. For example, right now the database can't have any I'm running into a use case where I need to save |
Here is an example.
if we escaped the values before they are sent over the wire, this could be decoded properly I think. |
@jontonsoup I am really sorry! I haven't had much time to think about this. Can you check the linked file and the tests, you might be able to find a good solution. |
@tothandras No worries! I looked into it more, and it doesn't look like that file is getting hit specifically. model_file
Right now the name field has the quote in it. |
Not sure if this is irrelevant b/c future plans to support mongoose objects #4.
But currently the string type returned is invalid json. It appears the json returned has single quotes instead of doubles.
This (invalid JSON)
Compared to this (valid):
If you point me to the right file, I can make a PR. Also, maybe I'm being silly, but wouldn't #4. be solved just by throwing this string into a JSON.parse() function?
I can do that as well if you would like.
Best,
Jon
The text was updated successfully, but these errors were encountered: