From 2f4b4480565dbd9374f2d24bed8885764394a6cf Mon Sep 17 00:00:00 2001 From: Brian Pepple Date: Tue, 14 Jul 2026 10:12:46 -0400 Subject: [PATCH] Add optional CommunityRating element to v1.1 schema Adds AverageRating (decimal, 0-5.0) and RatingCount (optional positiveInteger) sub-elements for tracking community rating data, along with sample XML and schema validation tests. --- drafts/v1.1/MetronInfo.xsd | 15 ++++++++++ drafts/v1.1/Sample.xml | 4 +++ tests/test.py | 56 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/drafts/v1.1/MetronInfo.xsd b/drafts/v1.1/MetronInfo.xsd index 1c7c9e5..220312b 100644 --- a/drafts/v1.1/MetronInfo.xsd +++ b/drafts/v1.1/MetronInfo.xsd @@ -29,6 +29,7 @@ + @@ -232,6 +233,13 @@ + + + + + + + @@ -326,6 +334,13 @@ + + + + + + + diff --git a/drafts/v1.1/Sample.xml b/drafts/v1.1/Sample.xml index 8a1ceb1..2bfda50 100644 --- a/drafts/v1.1/Sample.xml +++ b/drafts/v1.1/Sample.xml @@ -91,6 +91,10 @@ 76194130593600111 Everyone + + 4.5 + 1250 + Foo Bar #001 (2002) Foo Bar #002 (2022) diff --git a/tests/test.py b/tests/test.py index e77b3b8..22ca775 100644 --- a/tests/test.py +++ b/tests/test.py @@ -44,6 +44,27 @@ '' "Foo10", ), + ( + TEST_V11_XSD, + '' + "Foo" + "4.51250" + "", + ), + ( + TEST_V11_XSD, + '' + "Foo" + "0" + "", + ), + ( + TEST_V11_XSD, + '' + "Foo" + "5.0" + "", + ), ], ids=[ "valid_xml", @@ -54,6 +75,9 @@ "v11_volume_zero", "v11_alternative_number", "v11_alternative_number_absent", + "v11_community_rating", + "v11_community_rating_min", + "v11_community_rating_max", ], ) def test_valid(xsd: Path, xml: Path | str) -> None: @@ -92,6 +116,34 @@ def test_valid(xsd: Path, xml: Path | str) -> None: "Foo1" "1A1B", ), + ( + TEST_V11_XSD, + '' + "Foo" + "5.1" + "", + ), + ( + TEST_V11_XSD, + '' + "Foo" + "-0.1" + "", + ), + ( + TEST_V11_XSD, + '' + "Foo" + "100" + "", + ), + ( + TEST_V11_XSD, + '' + "Foo" + "4.50" + "", + ), ], ids=[ "dup_primary_attr_xml", @@ -101,6 +153,10 @@ def test_valid(xsd: Path, xml: Path | str) -> None: "v11_negative_page_count", "v11_negative_volume", "v11_duplicate_alternative_number", + "v11_community_rating_too_high", + "v11_community_rating_negative", + "v11_community_rating_missing_average", + "v11_community_rating_zero_count", ], ) def test_invalid(xsd: Path, xml: Path | str) -> None: