From b64c8e8bd22a2696363957fe3e5c451f24ff58a1 Mon Sep 17 00:00:00 2001 From: Marco Heinemann Date: Wed, 12 Nov 2025 00:32:34 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Test=20extra=20option?= =?UTF-8?q?=20schema=20null=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New test given_schema_with_null_field --- tests/schema/fixtures/extra_options.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/schema/fixtures/extra_options.yml b/tests/schema/fixtures/extra_options.yml index e085e2ca7..d657a5e3a 100644 --- a/tests/schema/fixtures/extra_options.yml +++ b/tests/schema/fixtures/extra_options.yml @@ -203,6 +203,27 @@ auto_inject_type_wrong_const: asil: const: QM +given_schema_with_null_field: + conf: | + extensions = ["sphinx_needs"] + needs_from_toml = "ubproject.toml" + needs_schema_definitions_from_json = "schemas.json" + ubproject: | + [[needs.extra_options]] + name = "asil" + schema.type = "string" + rst: | + .. impl:: title + :id: IMPL_1 + schemas: + $defs: [] + schemas: + - validate: + local: + properties: + asil: + const: QM + required_based_on_select_field_missing: conf: | extensions = ["sphinx_needs"] From cdaaa9a8437bcc3542a28de5450af0f3cdc438b2 Mon Sep 17 00:00:00 2001 From: Marco Heinemann Date: Wed, 12 Nov 2025 00:44:21 +0100 Subject: [PATCH 2/3] Added snapshot + ubc compatible --- tests/schema/__snapshots__/test_schema.ambr | 10 ++++++++++ tests/schema/fixtures/extra_options.yml | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/schema/__snapshots__/test_schema.ambr b/tests/schema/__snapshots__/test_schema.ambr index 99d1c28b5..42e797a3c 100644 --- a/tests/schema/__snapshots__/test_schema.ambr +++ b/tests/schema/__snapshots__/test_schema.ambr @@ -2807,6 +2807,16 @@ }), }) # --- +# name: test_schemas[schema/fixtures/extra_options-given_schema_with_null_field] + '' +# --- +# name: test_schemas[schema/fixtures/extra_options-given_schema_with_null_field].1 + dict({ + 'validated_needs_count': 1, + 'validation_warnings': dict({ + }), + }) +# --- # name: test_schemas[schema/fixtures/extra_options-integer_multiple_of] '' # --- diff --git a/tests/schema/fixtures/extra_options.yml b/tests/schema/fixtures/extra_options.yml index d657a5e3a..9ed8c6fbd 100644 --- a/tests/schema/fixtures/extra_options.yml +++ b/tests/schema/fixtures/extra_options.yml @@ -207,8 +207,9 @@ given_schema_with_null_field: conf: | extensions = ["sphinx_needs"] needs_from_toml = "ubproject.toml" - needs_schema_definitions_from_json = "schemas.json" ubproject: | + [needs] + schema_definitions_from_json = "schemas.json" [[needs.extra_options]] name = "asil" schema.type = "string" From 7b466cd957b90286cc2b8c30462263a9b7048fba Mon Sep 17 00:00:00 2001 From: Marco Heinemann Date: Wed, 12 Nov 2025 07:53:30 +0100 Subject: [PATCH 3/3] Add test for empty string --- tests/schema/__snapshots__/test_schema.ambr | 30 ++++++++++++++------- tests/schema/fixtures/extra_options.yml | 23 +++++++++++++++- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/tests/schema/__snapshots__/test_schema.ambr b/tests/schema/__snapshots__/test_schema.ambr index 42e797a3c..7eba0b855 100644 --- a/tests/schema/__snapshots__/test_schema.ambr +++ b/tests/schema/__snapshots__/test_schema.ambr @@ -2807,16 +2807,6 @@ }), }) # --- -# name: test_schemas[schema/fixtures/extra_options-given_schema_with_null_field] - '' -# --- -# name: test_schemas[schema/fixtures/extra_options-given_schema_with_null_field].1 - dict({ - 'validated_needs_count': 1, - 'validation_warnings': dict({ - }), - }) -# --- # name: test_schemas[schema/fixtures/extra_options-integer_multiple_of] '' # --- @@ -2871,6 +2861,16 @@ }), }) # --- +# name: test_schemas[schema/fixtures/extra_options-no_schema_with_empty_string_field] + '' +# --- +# name: test_schemas[schema/fixtures/extra_options-no_schema_with_empty_string_field].1 + dict({ + 'validated_needs_count': 1, + 'validation_warnings': dict({ + }), + }) +# --- # name: test_schemas[schema/fixtures/extra_options-number_multiple_of] '' # --- @@ -3011,6 +3011,16 @@ }), }) # --- +# name: test_schemas[schema/fixtures/extra_options-schema_with_null_field] + '' +# --- +# name: test_schemas[schema/fixtures/extra_options-schema_with_null_field].1 + dict({ + 'validated_needs_count': 1, + 'validation_warnings': dict({ + }), + }) +# --- # name: test_schemas[schema/fixtures/extra_options-set_type_string] '' # --- diff --git a/tests/schema/fixtures/extra_options.yml b/tests/schema/fixtures/extra_options.yml index 9ed8c6fbd..eed1a5b6f 100644 --- a/tests/schema/fixtures/extra_options.yml +++ b/tests/schema/fixtures/extra_options.yml @@ -203,7 +203,7 @@ auto_inject_type_wrong_const: asil: const: QM -given_schema_with_null_field: +schema_with_null_field: conf: | extensions = ["sphinx_needs"] needs_from_toml = "ubproject.toml" @@ -225,6 +225,27 @@ given_schema_with_null_field: asil: const: QM +no_schema_with_empty_string_field: + conf: | + extensions = ["sphinx_needs"] + needs_from_toml = "ubproject.toml" + ubproject: | + [needs] + schema_definitions_from_json = "schemas.json" + [[needs.extra_options]] + name = "asil" + rst: | + .. impl:: title + :id: IMPL_1 + schemas: + $defs: [] + schemas: + - validate: + local: + properties: + asil: + const: QM + required_based_on_select_field_missing: conf: | extensions = ["sphinx_needs"]