Option to hide metadata fields in the exported files (_links, _embedded)

Created on 7 February 2025, 3 months ago

Problem/Motivation

In the exported files I see a lot of metadata values in the keys _links, _embedded that is actually make no sense for exporting and importing.

Steps to reproduce

1. Try to export an entity, for example, a node with a couple of custom fields.

2. See in the exported JSON file a lot of unnecessary data in the keys _links, _embedded, an example:

{
    "_links": {
        "self": {
            "href": "https:\/\/my-site.ddev.site\/about-us?_format=hal_json"
        },
        "type": {
            "href": "https:\/\/my-site.ddev.site\/rest\/type\/node\/static_page"
        },
        "https:\/\/my-site.ddev.site\/rest\/relation\/node\/static_page\/revision_uid": [
            {
                "href": "https:\/\/my-site.ddev.site\/user\/16?_format=hal_json"
            }
        ],
        "https:\/\/my-site.ddev.site\/rest\/relation\/node\/static_page\/uid": [
            {
                "href": "https:\/\/my-site.ddev.site\/user\/0?_format=hal_json"
            }
        ],
        "https:\/\/my-site.ddev.site\/rest\/relation\/node\/static_page\/field_page_segment": [
            {
                "href": ""
            },
            {
                "href": ""
            },
            {
                "href": ""
            },
            {
                "href": ""
            },
            {
                "href": ""
            },
            {
                "href": ""
            },
            {
                "href": ""
            },
            {
                "href": ""
            },
            {
                "href": ""
            },
            {
                "href": ""
            },
            {
                "href": ""
            },
            {
                "href": ""
            }
        ]
    },
...
    "_embedded": {
        "https:\/\/my-site.ddev.site\/rest\/relation\/node\/static_page\/revision_uid": [
            {
                "_links": {
                    "self": {
                        "href": "https:\/\/my-site.ddev.site\/user\/16?_format=hal_json"
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/user\/user"
                    }
                },
                "uuid": [
                    {
                        "value": "bc570b53-f893-4bb4-b02f-3ed449cfee2a"
                    }
                ]
            }
        ],
        "https:\/\/my-site.ddev.site\/rest\/relation\/node\/static_page\/uid": [
            {
                "_links": {
                    "self": {
                        "href": "https:\/\/my-site.ddev.site\/user\/0?_format=hal_json"
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/user\/user"
                    }
                },
                "uuid": [
                    {
                        "value": "fac5574b-d787-47a0-a218-b739b0e8f37e"
                    }
                ]
            }
        ],
        "https:\/\/my-site.ddev.site\/rest\/relation\/node\/static_page\/field_page_segment": [
            {
                "_links": {
                    "self": {
                        "href": ""
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/paragraph\/featured_section_component"
                    }
                },
                "uuid": [
                    {
                        "value": "bb8ea24e-df93-4326-8652-ec5ecc0e459f"
                    }
                ],
                "target_revision_id": "114776"
            },
            {
                "_links": {
                    "self": {
                        "href": ""
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/paragraph\/featured_section_component"
                    }
                },
                "uuid": [
                    {
                        "value": "de9673a7-0036-4265-96db-461ea78c61d9"
                    }
                ],
                "target_revision_id": "114786"
            },
            {
                "_links": {
                    "self": {
                        "href": ""
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/paragraph\/number_showcase_component"
                    }
                },
                "uuid": [
                    {
                        "value": "029a5756-d0e9-40ef-85e6-24f10b23bf17"
                    }
                ],
                "target_revision_id": "114791"
            },
            {
                "_links": {
                    "self": {
                        "href": ""
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/paragraph\/content_description"
                    }
                },
                "uuid": [
                    {
                        "value": "00275803-ce8a-4def-b520-531646527042"
                    }
                ],
                "target_revision_id": "114801"
            },
            {
                "_links": {
                    "self": {
                        "href": ""
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/paragraph\/content_description"
                    }
                },
                "uuid": [
                    {
                        "value": "943843c5-19b7-46c5-ab9b-eed79e7e2127"
                    }
                ],
                "target_revision_id": "114811"
            },
            {
                "_links": {
                    "self": {
                        "href": ""
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/paragraph\/content_description"
                    }
                },
                "uuid": [
                    {
                        "value": "44c7cb1f-f81f-4b92-b9f3-da0674c44b67"
                    }
                ],
                "target_revision_id": "114826"
            },
            {
                "_links": {
                    "self": {
                        "href": ""
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/paragraph\/content_description"
                    }
                },
                "uuid": [
                    {
                        "value": "8fc7ec53-3050-45b7-aa70-d919533b6c51"
                    }
                ],
                "target_revision_id": "114836"
            },
            {
                "_links": {
                    "self": {
                        "href": ""
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/paragraph\/content_description"
                    }
                },
                "uuid": [
                    {
                        "value": "87b1c32c-9d5d-4b51-9e54-788b7ec698df"
                    }
                ],
                "target_revision_id": "114846"
            },
            {
                "_links": {
                    "self": {
                        "href": ""
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/paragraph\/horizontal_tiles_static"
                    }
                },
                "uuid": [
                    {
                        "value": "48045c0e-bf34-4af0-a5d1-ea55e057cf76"
                    }
                ],
                "target_revision_id": "114891"
            },
            {
                "_links": {
                    "self": {
                        "href": ""
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/paragraph\/gallery_carousel"
                    }
                },
                "uuid": [
                    {
                        "value": "6726e5c0-7743-4998-95cf-080116a4a1f6"
                    }
                ],
                "target_revision_id": "114916"
            },
            {
                "_links": {
                    "self": {
                        "href": ""
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/paragraph\/vertical_tiles_static"
                    }
                },
                "uuid": [
                    {
                        "value": "aa559dbb-bfa2-494a-bd5a-8d95327aa8f0"
                    }
                ],
                "target_revision_id": "114961"
            },
            {
                "_links": {
                    "self": {
                        "href": ""
                    },
                    "type": {
                        "href": "https:\/\/my-site.ddev.site\/rest\/type\/paragraph\/horizontal_tiles_static"
                    }
                },
                "uuid": [
                    {
                        "value": "b58783c7-9ff0-483d-b9b5-0f2cada238b9"
                    }
                ],
                "target_revision_id": "114996"
            }
        ]
    },
...
    "_dcd_metadata": {
        "export_timestamp": 1738916483
    }
}

I understand that this is metadata and it is added automatically by Drupal HAL and maybe even this data is really needed for some cases, but I'd prefer to not store it in the exported files.

Proposed resolution

Would be great to add an option to exclude these fields from exporting.
And just remove these keys from the entity objects on the export stage.

What do you think about this?

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

2.1

Component

Code

Created by

🇦🇲Armenia murz Yerevan, Armenia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024