Import: document EDA/KiCad columns, test both column forms, fix eda_invisible inversion (#1436)

- Document the eda_* import columns in docs/usage/import_export.md: the flat form and its short
  aliases, and the nested eda_info.* form used by the CSV/JSON export and the shipped
  part_import_example.csv.
- Add EntityImporterTest coverage locking in that BOTH the nested eda_info.* form and the flat
  form import the EDA fields correctly (the nested form already worked via the serializer but was
  untested, so an export -> re-import round-trip could silently regress).
- Fix the eda_invisible alias: it was a plain key-rename to eda_visibility, so eda_invisible=1
  stored visibility=true (made the part visible - the opposite of the name). It is now handled
  explicitly and inverted.
This commit is contained in:
Sebastian Almberg 2026-07-20 20:52:01 +02:00 committed by GitHub
parent 12b53f15ba
commit 3998248905
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 99 additions and 1 deletions

View file

@ -63,7 +63,9 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Norm
'eda_exclude_bom' => 'eda_exclude_from_bom',
'eda_exclude_board' => 'eda_exclude_from_board',
'eda_exclude_sim' => 'eda_exclude_from_sim',
'eda_invisible' => 'eda_visibility',
//NOTE: "eda_invisible" is intentionally NOT mapped here: it is the *inverse* of
//"eda_visibility", so a plain key rename would store the wrong value. It is handled
//(and inverted) explicitly in applyEdaFields().
];
public function __construct(
@ -235,6 +237,9 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Norm
}
if (isset($data['eda_visibility']) && $data['eda_visibility'] !== '') {
$edaInfo->setVisibility(filter_var($data['eda_visibility'], FILTER_VALIDATE_BOOLEAN));
} elseif (isset($data['eda_invisible']) && $data['eda_invisible'] !== '') {
//"eda_invisible" is the inverse convenience alias of "eda_visibility"
$edaInfo->setVisibility(!filter_var($data['eda_invisible'], FILTER_VALIDATE_BOOLEAN));
}
}