nebius/SWE-bench-extra huggingface dataset:
Repository: zimeon/ocfl-py

Issue:
Fix validation error for forward slash in `contentDirectory`
From https://github.com/OCFL/fixtures/pull/82 the error for this should be `E017` instead of `E018`

Comments:

Patch:
diff --git a/ocfl/data/validation-errors.json b/ocfl/data/validation-errors.json
index 1f53481..b3b07ff 100644
--- a/ocfl/data/validation-errors.json
+++ b/ocfl/data/validation-errors.json
@@ -86,9 +86,16 @@
        "en": "OCFL Object version directory %s includes an illegal file (%s)"
     }
   },
+  "E017": {
+    "params": ["where"],
+    "description": {
+       "en": "OCFL Object %s inventory contentDirectory must be a string and must not contain a forward slash (/)"
+    }
+  },
   "E018": {
+    "params": ["where"],
     "description": {
-       "en": "Content directory must not contain a forward slash (/) or be . or .."
+       "en": "OCFL Object %s inventory contentDirectory must not be either . or .."
     }
   },
   "E023": {
diff --git a/ocfl/inventory_validator.py b/ocfl/inventory_validator.py
index 44a15b4..021798b 100644
--- a/ocfl/inventory_validator.py
+++ b/ocfl/inventory_validator.py
@@ -79,7 +79,9 @@ class InventoryValidator():
         if 'contentDirectory' in inventory:
             # Careful only to set self.content_directory if value is safe
             cd = inventory['contentDirectory']
-            if not isinstance(cd, str) or '/' in cd or cd in ['.', '..']:
+            if not isinstance(cd, str) or '/' in cd:
+                self.error("E017")
+            elif cd in ('.', '..'):
                 self.error("E018")
             else:
                 self.content_directory = cd


Test patch:
diff --git a/tests/test_inventory_validator.py b/tests/test_inventory_validator.py
index bc87693..1551ca1 100644
--- a/tests/test_inventory_validator.py
+++ b/tests/test_inventory_validator.py
@@ -66,7 +66,10 @@ class TestAll(unittest.TestCase):
         iv = InventoryValidator(log=log)
         log.clear()
         iv.validate({"id": "like:uri", "contentDirectory": "not/allowed"})
-        self.assertIn('E018', log.errors)
+        self.assertIn('E017', log.errors)
+        log.clear()
+        iv.validate({"id": "like:uri", "contentDirectory": ["s"]})
+        self.assertIn('E017', log.errors)
         log.clear()
         iv.validate({"id": "like:uri", "contentDirectory": ".."})
         self.assertIn('E018', log.errors)
Repository: zimeon/ocfl-py

Issue:
Correctly handle validation with multiple entries for a given digest in `manifest`
See error case https://github.com/OCFL/fixtures/pull/78

Comments:

Patch:
diff --git a/ocfl/data/validation-errors.json b/ocfl/data/validation-errors.json
index 56eed29..64f9dbf 100644
--- a/ocfl/data/validation-errors.json
+++ b/ocfl/data/validation-errors.json
@@ -513,7 +513,13 @@
        "en": "OCFL Object %s inventory manifest content path %s must not begin or end with /."
     }
   },
-  "E101": {
+  "E101a": {
+    "params": ["where", "path"],
+    "description": {
+       "en": "OCFL Object %s inventory manifest content path %s is repeated."
+    }
+  },
+  "E101b": {
     "params": ["where", "path"],
     "description": {
        "en": "OCFL Object %s inventory manifest content path %s used as both a directory and a file path."
diff --git a/ocfl/inventory_validator.py b/ocfl/inventory_validator.py
index 4a918b5..83a0f6e 100644
--- a/ocfl/inventory_validator.py
+++ b/ocfl/inventory_validator.py
@@ -157,7 +157,7 @@ class InventoryValidator():
             # Check for conflicting content paths
             for path in content_directories:
                 if path in content_paths:
-                    self.error("E101", path=path)
+                    self.error("E101b", path=path)
         return manifest_files, manifest_files_correct_format, unnormalized_digests
 
     def validate_fixity(self, fixity, manifest_files):
@@ -417,7 +417,10 @@ class InventoryValidator():
             if element in ('', '.', '..'):
                 self.error("E099", path=path)
                 return False
-        # Accumulate paths and directories
+        # Accumulate paths and directories if not seen before
+        if path in content_paths:
+            self.error("E101a", path=path)
+            return False
         content_paths.add(path)
         content_directories.add('/'.join([m.group(1)] + elements[0:-1]))
         return True


Test patch:
diff --git a/tests/test_inventory_validator.py b/tests/test_inventory_validator.py
index 5db1512..af61b9d 100644
--- a/tests/test_inventory_validator.py
+++ b/tests/test_inventory_validator.py
@@ -101,7 +101,7 @@ class TestAll(unittest.TestCase):
         log.clear()
         # Conflicting content paths
         iv.validate_manifest({"067eca3f5b024afa00aeac03a3c42dc0042bf43cba56104037abea8b365c0cf672f0e0c14c91b82bbce6b1464e231ac285d630a82cd4d4a7b194bea04d4b2eb7": ['v1/content/a', 'v1/content/a/b']})
-        self.assertEqual(log.errors, ['E101'])
+        self.assertEqual(log.errors, ['E101b'])
 
     def test_validate_fixity(self):
         """Test validate_fixity method."""
@@ -373,6 +373,9 @@ class TestAll(unittest.TestCase):
         log.clear()
         self.assertFalse(iv.check_content_path('v1/xyz/.', cp, cd))
         self.assertEqual(log.errors, ['E099'])
+        log.clear()
+        self.assertFalse(iv.check_content_path('v1/xyz/anything', cp, cd))
+        self.assertEqual(log.errors, ['E101a'])
         # Good cases
         log.clear()
         self.assertTrue(iv.check_content_path('v1/xyz/.secret/d', cp, cd))
Repository: zimeon/ocfl-py

Issue:
URN Object IDs flagged as validation warning
OCFL objects with an `id` such as: "URN-3:HUL.DRS.OBJECT:100775205", are flagged as validation warnings. I believe these should be valid.. as URNs are valid URIs and the above URN-3 scheme is a valid URN.

See: https://www.iana.org/assignments/urn-informal/urn-3

Comments:

Patch:
diff --git a/CHANGES.md b/CHANGES.md
index 7be9540..b6f1827 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -5,6 +5,7 @@
   * Additional validation improvements:
     * Checks between version state in different version inventories
     * Check to see is extra directories look like version directories
+    * Fix URI scheme syntax check
   * Use additional fixtures in https://github.com/OCFL/fixtures for tests
 
 ## 2021-04-26 v1.2.2
diff --git a/ocfl/inventory_validator.py b/ocfl/inventory_validator.py
index 2dbe328..27eb807 100644
--- a/ocfl/inventory_validator.py
+++ b/ocfl/inventory_validator.py
@@ -65,7 +65,9 @@ class InventoryValidator():
             if not isinstance(iid, str) or iid == '':
                 self.error("E037a")
             else:
-                if not re.match(r'''(\w+):.+''', iid):
+                # URI syntax https://www.rfc-editor.org/rfc/rfc3986.html#section-3.1 :
+                # scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
+                if not re.match(r'''[a-z][a-z\d\+\-\.]*:.+''', iid, re.IGNORECASE):
                     self.warning("W005", id=iid)
                 self.id = iid
         else:


Test patch:
diff --git a/tests/test_inventory_validator.py b/tests/test_inventory_validator.py
index 6070546..37519a6 100644
--- a/tests/test_inventory_validator.py
+++ b/tests/test_inventory_validator.py
@@ -52,6 +52,17 @@ class TestAll(unittest.TestCase):
         iv.validate({"id": []})
         self.assertIn('E037a', log.errors)
         log.clear()
+        # Valid and invalid URIs
+        iv.validate({"id": "scheme:rest", "digestAlgorithm": "sha512"})
+        self.assertNotIn('W005', log.warns)
+        log.clear()
+        iv.validate({"id": "URN-3:rest", "digestAlgorithm": "sha512"})
+        self.assertNotIn('W005', log.warns)
+        log.clear()
+        iv.validate({"id": "a1+2-3z.:rest", "digestAlgorithm": "sha512"})
+        self.assertNotIn('W005', log.warns)
+        self.assertNotIn('W004', log.warns)
+        log.clear()
         iv.validate({"id": "not_a_uri", "digestAlgorithm": "sha256"})
         self.assertIn('W005', log.warns)
         self.assertIn('W004', log.warns)