locomotivecms / wagon

Wagon is a command line tool that let's you develop for Locomotive right on your local machine.
https://www.locomotivecms.com
MIT License
188 stars 117 forks source link

Deploying content entries with many_to_many relationship fails when field required: true #402

Open greyskin opened 3 years ago

greyskin commented 3 years ago

Steps to reproduce:

  1. Create 2 content_types with a many_to_many relationship as per the Locomotive Docs.
  2. Set a required: true attribute on one (or both) of the many_to_many fields in each content_type.
  3. Ensure there is at least one data entry for each content_type, referencing one another, e.g. For Content Type A:
    - Content Type A Entry 1:
    _slug: content_type_a_entry_1
    name: Content Type A Entry 1
    content_type_bs:
    - content_type_b_entry_1

    For Content Type B:

    - Content Type B Entry 1:
    _slug: content_type_b_entry_1
    name: Content Type B Entry 1
    content_type_as:
    - content_type_a_entry_1
  4. Run wagon deploy [env] -d -v

If you have set required: true on both Content Types, you should receive the following error:

persisting Content Type A Entry 1 [failed] Resource invalid: content_type_a must have at least one element

If you have set required: true on only Content Type B, it will deploy Content Type A Entry 1 without issue, but you should receive the following error:

persisting Content Type B Entry 1 [failed] Resource invalid: content_type_b must have at least one element