Problem · Drupal

Catch a replaced field in a Drupal config export

Drupal exports each field as two YAML files, one for storage and one for the content type. A field that is replaced gives at least four changed files among the many of a normal update. The site that reads the JSON:API finds out later.

An example

Take Umami, the demo site that comes with Drupal core. In November 2019 its authors replaced field_image with the media field field_media_image on the recipe content type.

What an agent sees

An agent that reads the JSON:API sees the field names of today. It cannot see that a name changed. The governed model keeps the names that the code was written for.

What you can do today

  • The YAML files from drush config:export. CoreModels reads the content types, the fields and the vocabularies and skips the rest. CoreModels needs no login to Drupal.
  • Your assistant imports them into a CoreModels project.
  • After the next change, the assistant audits the new files. The answer is pass or fail and names each removed field and each changed type.
  • The same check runs in a pull request with one command.

See the recorded run, with every prompt and answer

What it does not do

  • A field that becomes required is not reported.
  • A content type that is deleted is not reported. Its fields are no longer compared.
  • CoreModels reads the files you give it. It does not connect to your Drupal site.

← Back to Drupal

Start building

14-day free trial. Builder $49/mo after the trial. Cancel any time.