Problem/Motivation

Follow-up for #2300677: JSON:API POST/PATCH support for fully validatable config entities.

DELETE support was descoped from that, because:

  • DELETE is less commonly needed for config: typically, config mostly grows/evolves, usually content exists that depends on it. IOW: creating/updating config is more important (https://en.wikipedia.org/wiki/Pareto_principle).
  • Config dependencies make this tricky:
    1. Deleting a config entity that has other config entities depending on it should not be allowed.
    2. Or should it be allowed and should there be a way to delete a config entity and all its dependencies?
    3. Or … when deleting a config entity that nothing depends upon, but itself depends on another, should that result in the deletion of that other if it was the only one depending on it? (For example: FieldConfig depends on FieldStorageConfig, what if the last FieldConfig that depends on a given FieldStorageConfig is deleted; should that result in the deletion of that FieldStorageConfig too? Perhaps by specifying an optional deleteDependentsIfNoMoreDependees flag? 🫠 Same thing with Editor depending on FilterFormat and others.)
    4. Config entities may be necessary for content entities: #2413769: Prevent the deletion of a bundle entity if there are existing content entities of that bundle.
  • This is blocked on #3423462: [PP-2] JSON:API relationship/related support for config entities for a good DX, see #3.

Even if this is technically possible today, there clearly is a whole can of worms wrt the DX of config entity deletion via JSON:API.

The scope of this issue is to figure out that DX.

Steps to reproduce

N/A

Proposed resolution

TBD

Remaining tasks

Discuss, propose!

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Title: [PP-2] JSON:API DELETE support » [PP-2] JSON:API DELETE support for config entities
Issue summary: View changes
Issue tags: +missing config dependencies
wim leers’s picture

Title: [PP-2] JSON:API DELETE support for config entities » [PP-3] JSON:API DELETE support for config entities
Issue summary: View changes
Related issues: +#3423462: [PP-2] JSON:API relationship/related support for config entities

Having created #3423462: [PP-2] JSON:API relationship/related support for config entities, I now think that this should be postponed on that as well. Because once that is solved, the error response when for example trying to delete node.type.article would be able to provide a much richer validation error: it could say Deleting this while the <sensible relationship name thanks to #3423462> field still exists (and depends on the Article content type) is not possible because <reason>., for example.

wim leers’s picture

Title: [PP-3] JSON:API DELETE support for config entities » [PP-4] JSON:API DELETE support for config entities
Issue summary: View changes
Related issues: +#2413769: Prevent the deletion of a bundle entity if there are existing content entities of that bundle

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.