diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c7662680c2ab1300423690157be6a656d273550..29013891d7f53dd4c4d8164e79eecfa169fcb289 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed ### ### Fixed ### +- Empty Records can now be created (https://gitlab.com/caosdb/caosdb-crawler/-/issues/27) * [#58](https://gitlab.com/caosdb/caosdb-crawler/-/issues/58) Documentation builds API docs in pipeline now. diff --git a/src/caoscrawler/converters.py b/src/caoscrawler/converters.py index 4b1aa09ec55003b0327372ce6c0fc80354d4f646..930a08c167e17efaed39b4b9045589cde68b2e8c 100644 --- a/src/caoscrawler/converters.py +++ b/src/caoscrawler/converters.py @@ -235,6 +235,12 @@ def create_records(values: GeneralStore, records: RecordStore, def_records: dict keys_modified = [] for name, record in def_records.items(): + # If only a name was given (Like this: + # Experiment: + # ) set record to an empty dict / empty configuration + if record is None: + record = {} + role = "Record" # This allows us to create e.g. Files if "role" in record: diff --git a/unittests/test_parent_cfood.yml b/unittests/test_parent_cfood.yml index afb158b3315505a179c780584b5c7fbbc2aac45b..b8d0eaf597641d311cb70017dc2bc75c7c3434f3 100644 --- a/unittests/test_parent_cfood.yml +++ b/unittests/test_parent_cfood.yml @@ -10,7 +10,6 @@ data: match_name: '.*' records: Experiment: - name: "e" Projekt: parents: ["project"] name: "p" @@ -25,6 +24,7 @@ data: records: Experiment: parents: ["Exp"] + name: "e" Projekt: parents: ["Projekt"] Campaign: