From 4704c1ff7a8adf918f7448c36b7a09fac7743538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Kuchenbecker?= Date: Wed, 15 May 2024 11:01:11 +0000 Subject: [PATCH] Clarify default for 'required', add explicit example --- .../add_content_properties/instruction.py | 2 +- .../add_content_properties/multiple/config.yaml | 9 +++++++++ .../multiple/transformed.datapack.yaml | 3 +++ .../multiple/transformed.schemapack.yaml | 4 ++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/metldata/builtin_transformations/add_content_properties/instruction.py b/src/metldata/builtin_transformations/add_content_properties/instruction.py index d3d1ab5..5b56771 100644 --- a/src/metldata/builtin_transformations/add_content_properties/instruction.py +++ b/src/metldata/builtin_transformations/add_content_properties/instruction.py @@ -58,7 +58,7 @@ class AddContentPropertyInstruction(BaseSettings): True, description=( "Indicates whether the newly added property shall be added to the" - + " 'required' list of the corresponding object." + + " 'required' list of the corresponding object. Defaults to 'True'." ), ) diff --git a/tests/fixtures/example_transformations/add_content_properties/multiple/config.yaml b/tests/fixtures/example_transformations/add_content_properties/multiple/config.yaml index 11a79a4..ce4e87c 100644 --- a/tests/fixtures/example_transformations/add_content_properties/multiple/config.yaml +++ b/tests/fixtures/example_transformations/add_content_properties/multiple/config.yaml @@ -11,3 +11,12 @@ add_content_properties: content_schema: type: "boolean" value: false + # required is not set, so it defaults to false +- class_name: File + target_content: + object_path: "" + property_name: "content_description" + content_schema: + type: "string" + required: true + value: "" diff --git a/tests/fixtures/example_transformations/add_content_properties/multiple/transformed.datapack.yaml b/tests/fixtures/example_transformations/add_content_properties/multiple/transformed.datapack.yaml index 8d9aa7e..4e110b6 100644 --- a/tests/fixtures/example_transformations/add_content_properties/multiple/transformed.datapack.yaml +++ b/tests/fixtures/example_transformations/add_content_properties/multiple/transformed.datapack.yaml @@ -9,6 +9,7 @@ resources: size: 12321 additional_information: # <- compression: false + content_description: "" # <- file_b: content: filename: file_b.fastq @@ -17,6 +18,7 @@ resources: size: 12314 additional_information: # <- compression: false + content_description: "" # <- file_c: content: filename: file_c.fastq @@ -25,6 +27,7 @@ resources: size: 12123 additional_information: # <- compression: false + content_description: "" # <- Dataset: dataset_1: content: diff --git a/tests/fixtures/example_transformations/add_content_properties/multiple/transformed.schemapack.yaml b/tests/fixtures/example_transformations/add_content_properties/multiple/transformed.schemapack.yaml index 10a8d5c..2a9ada0 100644 --- a/tests/fixtures/example_transformations/add_content_properties/multiple/transformed.schemapack.yaml +++ b/tests/fixtures/example_transformations/add_content_properties/multiple/transformed.schemapack.yaml @@ -31,6 +31,9 @@ classes: "required": [ "compression" ], + }, + "content_description": { + "type" : "string" } }, "required": [ @@ -38,6 +41,7 @@ classes: "format", "checksum", "size", + "content_description", ], "type": "object" }