Use automergeAttrs for BaseResource and subclasses.

Review Request #13853 — Created May 13, 2024 and submitted

Information

Review Board
release-7.x

Reviewers

This change makes use of automergeAttrs for our resource classes.
Spina itself specifies this for defaults, which means we don't have to
manually call _.defaults() for all of these. This additionally makes
use of it for attrToJsonMap, deserializers, and serializers.

  • Ran js-tests.
  • Verified that all objects were properly automerged.
Summary ID
Use automergeAttrs for BaseResource and subclasses.
This change makes use of `automergeAttrs` for our resource classes. Spina itself specifies this for `defaults`, which means we don't have to manually call `_.defaults()` for all of these. This additionally makes use of it for `attrToJsonMap`, `deserializers`, and `serializers`. Testing Done: - Ran js-tests. - Verified that all objects were properly automerged.
d732b84d5bee784659db9673c7b4f8ef9e8be876
Description From Last Updated

Does this not work as: static defaults(): Result<Partial<BaseCommentAttrs>> { ... } It should accept both and merge that correctly. Also, …

chipx86chipx86

This can just be a static result now, I think.

chipx86chipx86
maubin
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. Show all issues

    Does this not work as:

    static defaults(): Result<Partial<BaseCommentAttrs>> {
        ...
    }
    

    It should accept both and merge that correctly.

    Also, Spina exposes its own Result, so no need for the Backbone._Result.

  3. 
      
david
chipx86
  1. 
      
  2. Show all issues

    This can just be a static result now, I think.

  3. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-7.x (117297c)
Loading...