Problem/Motivation
Asking JSON:API's serializer for the schema of a field item list overwrites the values in that list. And saving the entity afterwards stores the sample values.
FieldNormalizer::getNormalizationSchema() needs one field item to describe, so it has this code:
$field_item = $object->appendItem($object->generateSampleItems());
FieldItemList::generateSampleItems() has no return value. It generates sample values and passes them to $this->setValue(), which replaces every value in the list.
appendItem(NULL) then adds an empty item, and only that item is removed afterwards. So the list ends up with the sample values, and the schema is built from an empty item, not a sample.
Issue fork drupal-3643170
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
mukesh-kumar3 commentedComment #5
mukesh-kumar3 commentedNightwatch initially errored during logout in the setup hook for
machineNameTransliterationTest. The job passed on retrywithout code changes.