{"action":"opened","issue":{"url":"https://api.github.com/repos/Scille/umongo/issues/132","repository_url":"https://api.github.com/repos/Scille/umongo","labels_url":"https://api.github.com/repos/Scille/umongo/issues/132/labels{/name}","comments_url":"https://api.github.com/repos/Scille/umongo/issues/132/comments","events_url":"https://api.github.com/repos/Scille/umongo/issues/132/events","html_url":"https://github.com/Scille/umongo/issues/132","id":330894528,"node_id":"MDU6SXNzdWUzMzA4OTQ1Mjg=","number":132,"title":"Updating a dynamic document with validation","user":{"login":"Relrin","id":1627100,"node_id":"MDQ6VXNlcjE2MjcxMDA=","avatar_url":"https://avatars3.githubusercontent.com/u/1627100?v=4","gravatar_id":"","url":"https://api.github.com/users/Relrin","html_url":"https://github.com/Relrin","followers_url":"https://api.github.com/users/Relrin/followers","following_url":"https://api.github.com/users/Relrin/following{/other_user}","gists_url":"https://api.github.com/users/Relrin/gists{/gist_id}","starred_url":"https://api.github.com/users/Relrin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Relrin/subscriptions","organizations_url":"https://api.github.com/users/Relrin/orgs","repos_url":"https://api.github.com/users/Relrin/repos","events_url":"https://api.github.com/users/Relrin/events{/privacy}","received_events_url":"https://api.github.com/users/Relrin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-09T15:06:52Z","updated_at":"2018-06-09T15:06:52Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI'm trying to deal with updating a dynamic document with passing a validation process before applying changes. The project have tests that's make ensure that everything is going as expected, but they're returning errors instead:\r\n\r\n```\r\n_______________________________________ test_worker_returns_updated_player_statistics_with_extra_fields ________________________________________Traceback (most recent call last):\r\n  File \"/app/tests/test_update_player_statistics.py\", line 106, in test_worker_returns_updated_player_statistics_with_extra_fields\r\n    assert Response.CONTENT_FIELD_NAME in response.keys()\r\nAssertionError: assert 'content' in dict_keys(['error', 'event-name'])\r\n +  where 'content' = Response.CONTENT_FIELD_NAME\r\n +  and   dict_keys(['error', 'event-name']) = <built-in method keys of dict object at 0x7f86ee7bdd38>()\r\n +    where <built-in method keys of dict object at 0x7f86ee7bdd38> = {'error': {'details': {'_schema': ['Unknown field name winrate.', 'Unknown field name nickname.']}, 'type': 'ValidationError'}, 'event-name': 'event-name'}.keys\r\n```\r\n\r\nThis errors is raised by a couple of issues:\r\n1) The processing worker is using the default Marshmallow schema for serializing and send the response after it. \r\n2) In the case of updating document the worker is using a custom schema for it, and it was passed successfully, trying to apply those changes to the document. After validating, the worker is trying to save a result, but instead of it, passing one more time the validating process with the default schema.\r\n\r\nBased on this description, I have a couple of questions:\r\n1) Does it possible to disable the default generated Marshmallow schema, so that I could control the validation process separately and save the changes directly without passing validation one more time?\r\n2) In the actual moment of time Marshmallow isn't providing any methods for saving extra fields (which are wasn't specified) in your data, and, therefore, a developer must override a load/loads methods for doing it manually. I've tried to set up the `strict=False` option in the code, however it wasn't helped me. Any suggestions/ideas how it can be done?\r\n\r\nLinks to source code:\r\n- [The used document](https://github.com/OpenMatchmaking/microservice-player-statistics/blob/feature-crud-tests/player-statistics/app/statistics/documents.py#L11-L52) with MongoDb\r\n- [The custom schema](https://github.com/OpenMatchmaking/microservice-player-statistics/blob/feature-crud-tests/player-statistics/app/statistics/schemas.py#L27-L60) for validating an input\r\n- [AMQP Worker](https://github.com/OpenMatchmaking/microservice-player-statistics/blob/feature-crud-tests/player-statistics/app/workers/update_player_statistics.py#L26-L49) that's using a custom schema during processing request"}}
{"actor":{"display_login":"Relrin"}}