-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do we need to clarify that "fixity": null
is not allowed, or should we allow it?
#558
Comments
I'm a proponent of only listing the fixity block if it has digests in it. Having a random |
we all agree that if something isn't in the fixity block then the fixity key should not be present. |
For what it's worth, ocfl-java serializes empty fixity blocks as |
Furthermore, if you were to convince me that it is not a good idea to serialize the empty maps, I still don't see why the spec needs to be involved here. This PR is making it an error to produce what some json libraries produce naturally and every json library should support reading. |
@pwinckles - I do NOT feel we should allow |
To me it doesn't seem necessary to specify because I would expect every client to be able to deal with all 3 empty possibilities because that's the nature of working with json. After deserializing, I cannot tell the difference between a field that was present but with a null value and a field that was not present. I also don't see what the harm is of serializing an empty map. As noted in the PR, if you do disallow it, |
In the commit to ocfl-py, the example inventories have empty |
Yes, that is why I feel it would be OK to allow I still think |
It would be the case with any non-map based representation of json. It is simply not possible to know if a field was explicitly set to |
@zimeon Coming around to your point of view, I can see a case for removing any question of ambiguity for null values in case it did matter in some languages. So, maybe just allow the empty map then? |
One final thought, and then I'll shut up about it. If you think about it as a map then I agree that it doesn't make sense to allow null values. But, if you think about it as an object that has a finite set of defined attributes, then I think that it makes perfect sense to allow null values. The only difference between That said, I personally think the explicit form is ugly and I never serialize nulls when I work with json. However, I don't think it's wrong. |
Reflecting on the original issue (zimeon/ocfl-py#79), I am slightly surprised that the validator reports the following as invalid:
My thinking is that the OCFL specification and the JSON associated with it (e.g. If anything, I would suggest clarifying the OCFL specification fixity language along the lines of:
|
Per the JSON specification https://www.rfc-editor.org/rfc/rfc8259#section-3 (and also https://www.json.org/json-en.html and https://www.ecma-international.org/publications-and-standards/standards/ecma-404/), the value |
@zimeon I assume when you say "certain implementations my serialize If so, I now agree with you. I just did some experiments with the JSON schema inventory file and a couple of different validators. They all agree that As you've pointed out, the JSON spec does not define the schematics of This was a little surprising to me. I do think it's worth stating that the OCFL spec does not accept |
Ironically, I just tried rocfl against inventories with |
Although I can understand the stylistic preference for not wanting |
I don't think the ambiguity test provides us sufficient guidance in this case: Allowing I think clarity and simplicity provide better guidance:
|
editors agree we will allow an empty object but will not require it. and will not allow null. |
From zimeon/ocfl-py#79:
The text was updated successfully, but these errors were encountered: