-
Notifications
You must be signed in to change notification settings - Fork 301
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
Deserializer throws away fields named type
and links
#559
Comments
@janneraiskila, what version of flask-restless are you using? string_to_datetime() builds a dictionary where-as string_to_datetime() does the dirty work. Can you define "throws it away"? Is there a value missing or is it a NoneType? Can you provide a little more information on any errors you get, steps to reproduce, data you're having trouble with, anything other than "it doesn't work"? |
Hi @AlmightyOatmeal, I'm using HEAD. Notice that the list comprehension inside |
@janneraiskila, list comprehension is not used in
If you look at the output JSON, "type" and "links" are being used in the resulting JSON. I will see if it is necessary to exclude those fields from the dictionary parsing. |
Hi @AlmightyOatmeal, That is a Python Here's a reproduction gist modified from the "Quickstart" tutorial code on the documentation site. Just attempt to POST to /api/person, e.g.:
|
@janneraiskila, that gist and output similar to this would have saved a lot of time in the beginning. I've recreated the error:
Looking through every instance where strings_to_datetimes() is called and it would only affect attributes. Referencing the JSON API specifications, there should not be a JSON API "type" reference within an "attributes" object (http://jsonapi.org/format/#document-resource-object-attributes) so I see no reason why "type" is being omitted. @janneraiskila, I would recommend a sqlite URI of just 'sqlite://' to create an in-memory database for the sake if testing so there aren't random database files laying about :) |
* Fixes jfinkels#559 regarding omission of 'type' field from attributes object. No tests failed due to this change. * Changed list comprehension wrapped in dict() constructor with dict comprehension. * Changed comprehension variables to something more human-readable.
* Fixes jfinkels#559 by removing the included portion instead of trying to map the entire table.
* Fixes jfinkels#559 by removing the included portion instead of trying to map the entire table.
This should be fixed by pull request #569. |
If my SQLAlchemy models have a field called
type
, and I pass a value for it in theattributes
hash in a JSON API request, thestrings_to_datetimes
function insidehelpers.py
throws it away prior to updating the SQLAlchemy model object.The text was updated successfully, but these errors were encountered: