Feeds importer validate all entity feilds, not only those mapped. This cause errors when you have required fields.

This is an error that already happened in D7 version #2918840: Field validation errors in item: only validate mapped fields.

I implemented a patch/workaround in entityValidate() for EntityProcessorBase.php

Comments

dariogcode created an issue. See original summary.

dariogcode’s picture

Basically the patch check if the "violation" is made by a field, and if the field is in mapping targets.

Tested againts 8.x-3.0-alpha6

dariogcode’s picture

Issue summary: View changes
megachriz’s picture

Status: Active » Needs work

@dariogcode
Thanks for the idea. In some cases this could be useful. In other cases though this can cause less user friendly SQL errors, like the one in the automated test. So with your patch, if someone forgets to map to node title, this will result into a SQL error.

I know I implemented this in the D7 version but I think D8 is more strict in this regard. A possible solution to overcome the most likely SQL errors, would be to only skip configured fields. So if the error is on a base field of an entity, we let the validation fail even if not mapped to that base field.

I think ideally Feeds should warn you if you didn't map to all required fields on the mapping page, but that would be food for an other issue.

Coding standards
Your patch contains some coding standard issues, see https://www.drupal.org/pift-ci-job/1460628.

mehul.shah’s picture

Subscribing to this issue. It should only validate the base entity fields and configured fields.

socialnicheguru’s picture

megachriz’s picture

Title: "This value should not be null." Feeds validate non mapped fields » Skip validation of unmapped fields
Related issues: +#3062232: Settings to disable entity validation