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

Make merging of nested documents optional (enabled by default) #1140

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
2 participants
@NotSpecial
Copy link
Contributor

NotSpecial commented May 5, 2018

Rationale

In the fix for #519, merging of nested documents on PATCH was introduced,
essentially a original.update(updates) is performed.
So far, the only way to avoid this is to use PUT (see #712), however,
this is not always desirable.

We have a use case where we only want to update a nested field of a
document, therefore the appropriate HTML verb is PATCH since we do not want
to replace the whole document.
In this nested field, we need to remove a key, which, due to the merging,
is currently impossible.

Changes

  • Introduce a new setting, MERGE_NESTED_DOCUMENTS, to control this behaviour
    globally or per-resource.
    Per default, this is set to True, so that nothing changes compares to the
    current version of Eve except when the configuration is changed explicitly.
  • Add a test
  • Add documentation
Make merging of nested documents optional (enabled by default)
Rationale
---------

In the fix for #519, merging of nested documents on `PATCH` was introduced,
essentially a `original.update(updates)` is performed.
So far, the only way to avoid this is to use `PUT` (see #712), however,
this is not always desirable.

We have a use case where we only want to update a nested field of a
document, therefore the appropriate HTML verb is `PATCH` since we do not want
to replace the whole document.
In this nested field, we need to remove a key, which, due to the merging,
is currently impossible.

Changes
-------

- Introduce a new setting, `MERGE_NESTED_DOCUMENTS`, to control this behaviour
  globally or per-resource.
  Per default, this is set to `True`, so that nothing changes compares to the
  current version of Eve except when the configuration is changed explicitly.
- Add a test
- Add documentation

nicolaiarocci added a commit that referenced this pull request May 9, 2018

@nicolaiarocci

This comment has been minimized.

Copy link
Member

nicolaiarocci commented May 9, 2018

Rebased and merged 72d8f8d

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.