zimeon / ocfl-py

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

Persistent errors for user description. #79

Closed johnguirgis closed 3 years ago

johnguirgis commented 3 years ago

I am trying to validate a simple OCFL object but I keep getting this warning and error regardless of the object I am trying to validate:

[E056a] OCFL Object root inventory includes a fixity key with value that isn't a JSON object (see https://ocfl.io/1.0/spec/#E056)
[W009] OCFL Object root inventory v1 version block user description SHOULD be a mailto: or person identifier URI (see https://ocfl.io/1.0/spec/#W009)
INFO:ocfl.object:OCFL object at ../root/test%3Acommitmsg/ is INVALID

this is the v1 inventory file in question

{
    "id": "test:commitmsg",
    "type": "https://ocfl.io/1.0/spec/#inventory",
    "digestAlgorithm": "sha512",
    "head": "v1",
    "manifest": {
        "0c1dc1ece20a18bd5ce7b41efe8e29e2e5710553b4716324415b26f48262d95888240d1169f6dd6dfd790dfd108aef91f6bfc99fbf2f0e54ae0d9eb75f77c054": [
            "v1/content/README.md"
        ]
    },
    "versions": {
        "v1": {
            "created": "2021-07-07T13:55:50.992Z",
            "message": "This is my message",
            "user": {
                "name": "myName",
                "address": "me@example.org"
            },
            "state": {
                "0c1dc1ece20a18bd5ce7b41efe8e29e2e5710553b4716324415b26f48262d95888240d1169f6dd6dfd790dfd108aef91f6bfc99fbf2f0e54ae0d9eb75f77c054": [
                    "README.md"
                ]
            },
            "type": ""
        }
    },
    "fixity": null
}

I am especially confused by the W009 error since the user address is a valid mailto. I am new to working with OCFL objects so this may be a naive issue, but does anyone have idea what is causing these issue or how to resolve them?

zimeon commented 3 years ago

Hi @johnguirgis :

"fixity": null is not valid in the inventory, you should omit the fixity key unless it has a JSON object value (reason for E056a)

The address value should be a URI, thus mailto:me@example.org and not me@example.org (reason for W009)

pwinckles commented 3 years ago

@zimeon "fixity": null is valid JSON. If it is forbidden, the spec should make that clear.

zimeon commented 3 years ago

@pwinckles - I think it is clear in https://ocfl.io/1.0/spec/#fixity "The fixity block MUST contain keys corresponding to the controlled vocabulary given in the digest algorithms listed in the Digests section, or in a table given in an Extension." -- this implies a JSON object but if we want to add further clarification then that would be a spec issue

pwinckles commented 3 years ago

Right, but I would interpret that to mean that if there is a fixity block then it must have those properties. The fact that fixity is null, to me, means that it does not have a fixity block. Serializing missing fields to null is typical, and often configurable, for some JSON serializers.