zimeon / ocfl-py

OCFL tools in Python
MIT License
20 stars 6 forks source link

Update for spec changes regarding fixity object #87

Closed zimeon closed 2 years ago

zimeon commented 2 years ago

Following on from #79 and the spec changes in #IIIF/spec:580, need to update code to use E111 to replace E055 and allow fixity as empty JSON object

zimeon commented 2 years ago

Had already implement E111a and E111b, actual change required is to remove the check+error for an empty object because we have now agreed that that is allowed.

zimeon commented 2 years ago
(py38) simeon@RottenApple ocfl-py> more extra_fixtures/1.1/good-objects/empty_fixity/inventory.json
{
  "digestAlgorithm": "sha512",
  "head": "v1",
  "id": "http://example.org/minimal_no_content",
  "fixity": { },
  "manifest": { },
  "type": "https://ocfl.io/1.1/spec/#inventory",
  "versions": {
    "v1": {
      "created": "2019-01-01T02:03:04Z",
      "message": "One version and no content, empty fixity",
      "state": { },
      "user": { "address": "mailto:Person_A@example.org", "name": "Person A" }
    }
  }
}
(py38) simeon@RottenApple ocfl-py> ./ocfl-validate.py extra_fixtures/1.1/good-objects/empty_fixity
INFO:ocfl.object:OCFL object at extra_fixtures/1.1/good-objects/empty_fixity is VALID

(py38) simeon@RottenApple ocfl-py> more extra_fixtures/1.1/bad-objects/E111_null_fixity/inventory.json
{
  "digestAlgorithm": "sha512",
  "head": "v1",
  "id": "http://example.org/minimal_no_content",
  "fixity": null,
  "manifest": { },
  "type": "https://ocfl.io/1.1/spec/#inventory",
  "versions": {
    "v1": {
      "created": "2019-01-01T02:03:04Z",
      "message": "One version and no content",
      "state": { },
      "user": { "address": "mailto:Person_A@example.org", "name": "Person A" }
    }
  }
}
(py38) simeon@RottenApple ocfl-py> ./ocfl-validate.py extra_fixtures/1.1/bad-objects/E111_null_fixity
[E060] Mismatch between actual and recorded inventory digests for inventory.json (calculated 7852e487502fb97643658f35940b2ae97c0aaf4220701b006b8a4dd3db43588be2409435f4543a0dd5ae090b74eb8cca2240b5831adcc2a5045de07bbe3b85ec but read 516dc0fbea0be2f199f83d28db4f6773b887c3c8001d86df10d4a1610d1f9687199c9705626fcaf1f172ee36e912860ffed95a00bc5c52b8355d05a21ebadd3b from inventory.json.sha512) (see https://ocfl.io/1.0/spec/#E060)
[E060] Mismatch between actual and recorded inventory digests for v1/inventory.json (calculated 7852e487502fb97643658f35940b2ae97c0aaf4220701b006b8a4dd3db43588be2409435f4543a0dd5ae090b74eb8cca2240b5831adcc2a5045de07bbe3b85ec but read 516dc0fbea0be2f199f83d28db4f6773b887c3c8001d86df10d4a1610d1f9687199c9705626fcaf1f172ee36e912860ffed95a00bc5c52b8355d05a21ebadd3b from v1/inventory.json.sha512) (see https://ocfl.io/1.0/spec/#E060)
[E111] OCFL Object root inventory includes a fixity key with value that isn't a JSON object (see https://ocfl.io/1.0/spec/#E111)
INFO:ocfl.object:OCFL object at extra_fixtures/1.1/bad-objects/E111_null_fixity is INVALID

(should fix the example so the E060 errors don't show)

zimeon commented 2 years ago

Resolved:

(py3) simeon@Cyser ocfl-py> ./ocfl-validate.py extra_fixtures/1.1/good-objects/empty_fixity
INFO:ocfl.object:OCFL object at extra_fixtures/1.1/good-objects/empty_fixity is VALID
(py3) simeon@Cyser ocfl-py> ./ocfl-validate.py extra_fixtures/1.1/bad-objects/E111_null_fixity
[E111] OCFL Object root inventory includes a fixity key with value that isn't a JSON object (see https://ocfl.io/1.0/spec/#E111)
INFO:ocfl.object:OCFL object at extra_fixtures/1.1/bad-objects/E111_null_fixity is INVALID