From 302b75dba438052f624e4c078fd674492d18b8f8 Mon Sep 17 00:00:00 2001 From: Tom Clark Date: Tue, 29 Apr 2025 11:03:27 +0100 Subject: [PATCH] ENH: Make design_basis section optional --- power-curve-schema/schema.json | 5 ++--- test/test_design_basis.py | 9 ++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/power-curve-schema/schema.json b/power-curve-schema/schema.json index d0a5055..59a155c 100644 --- a/power-curve-schema/schema.json +++ b/power-curve-schema/schema.json @@ -375,7 +375,7 @@ "uniqueItems": true } }, - "required": ["document", "turbine", "design_bases", "power_curves"], + "required": ["document", "turbine", "power_curves"], "properties": { "document": { "type": "object", @@ -1049,7 +1049,6 @@ "label", "name", "description", - "design_bases", "cuts", "parameters", "power_is_coefficient", @@ -1076,7 +1075,7 @@ }, "design_bases": { "type": "array", - "description": "A list of the design basis labels relevant to this power curve", + "description": "A list of the design basis labels relevant to this mode. The 'design_bases' array is not required, so this field is also not required. However, if the 'design_bases' array is provided, this field should be populated in order to determine the applicable base(s).", "items": { "type": "string" }, diff --git a/test/test_design_basis.py b/test/test_design_basis.py index 2db105a..6d708a3 100644 --- a/test/test_design_basis.py +++ b/test/test_design_basis.py @@ -1,9 +1,10 @@ # Turn off pylint warnings unavoidable with pytest # pylint: disable=redefined-outer-name, line-too-long, redefined-builtin, missing-module-docstring +import pytest from jsonschema import validate from jsonschema.exceptions import ValidationError -import pytest + from .helpers import get_subschema @@ -19,7 +20,5 @@ def test_generic_11_3_design_basis_1(subschema, generic_117_3): def test_missing_design_basis(subschema): - """Validation should fail if there is no design basis section""" - with pytest.raises(ValidationError) as e: - validate(instance={}, schema=subschema) - assert "'design_bases' is a required property" in str(e) + """Validation should pass if there is no design basis section""" + validate(instance={}, schema=subschema)