Problem/Motivation

Create a commerce_wishlist entity through json api without setting the wishlist_items like we can in the web UI.

Steps to reproduce

POST: /jsonapi/commerce_wishlist/default

{
    "data": {
    	"type": "commerce_wishlist--default",
        "attributes": {
            "name": "My custom title"
        }
    }
}

ERROR:

"errors": [
        {
            "title": "Unprocessable Entity",
            "status": "422",
            "detail": "wishlist_items: This value should not be null.",
            "source": {
                "pointer": "/data/attributes/wishlist_items"
            }
        }
    ],

Proposed resolution

Allow to creating the empty wishlist like in:
$wishlist_provider->createWishlist('playlist', $this->currentUser);

CommentFileSizeAuthor
#2 3165912-2.patch797 bytesintrofini

Comments

introfini created an issue. See original summary.

introfini’s picture

StatusFileSize
new797 bytes

As discussed on Slack with Matt:

mglaman:centarro:
So the quick fix would be hook_base_field_alter or w/e to remove required flag

Here is the patch that removes the required flag...

  • jsacksick committed 296f3d7 on 8.x-3.x authored by introfini
    Issue #3165912 by introfini: Allow creating wishlists without wishlist...
jsacksick’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.