-
-
Notifications
You must be signed in to change notification settings - Fork 745
Closed
Milestone
Description
Expected Behavior
The expected behavior when replacing a document with the same document requested, PyEve should always accept the document.
For example:
- modify the "works" definition in https://github.com/pyeve/eve-demo/blob/master/settings.py
change the work owner's type from objectid to dbref. - manually modify the test database with appropriate dbref data structure.
- make a request to the work document endpoint
it will return
{"_created": "Fri, 07 Dec 2018 19:07:07 GMT", "_id": "5c0ac4db3cad1f378bc436fe", "_links": {"collection": {"href": "works", "title": "works"}, "parent": {"href": "/", "title": "home"}, "self": {"href": "works/5c0ac4db3cad1f378bc436fe", "title": "Work"}}, "_updated": "Fri, 07 Dec 2018 19:18:33 GMT", "description": "Description #0", "id": "5c0ac4db3cad1f378bc436fe", "owner": {"$id": "5c0ac4db3cad1f378bc436fd", "$ref": "people"}, "title": "Book Title #0"}
the owner now has two keys: $id and $ref - make a put request to replace the original document endpoint, it should return with no error.
In short, executing
curl http://localhost:5000/works/5c0ac4db3cad1f378bc436fe -o curl.txt
then
curl -X PUT -d @curl.txt --header "Content-Type: application/json" http://localhost:5000/works/5c0ac4db3cad1f378bc436fe
should produce no error
Actual Behavior
the second request produced the following 422 error
{"_issues": {"owner": "must be of dbref type"}, "_status": "ERR"}
However, if I change owner from $ref to $col in the txt file, it will be able to replace the original document.
Seems the dbref fields are not defined consistently, and will cause confusion when actually using it.
Environment
- Python version: 3.7.1
- Eve version: 0.8.1
Metadata
Metadata
Assignees
Labels
No labels