Skip to content
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

1.1/bad-objects/E001_invalid_version_format #104

Open
je4 opened this issue Oct 19, 2022 · 6 comments
Open

1.1/bad-objects/E001_invalid_version_format #104

je4 opened this issue Oct 19, 2022 · 6 comments

Comments

@je4
Copy link

je4 commented Oct 19, 2022

Hi,

While implementing OCFL checker functionality, the error produced by "1.1/bad-objects/E001_invalid_version_format" is E104 not E001 as suggested in the folder name.
Should the object folder be renamed to "1.1/bad-objects/E104_invalid_version_format"?

best, Jürgen

@zimeon
Copy link
Collaborator

zimeon commented Oct 19, 2022

To me, the extra directory should trigger E001.My validator reports:

> ./ocfl-validate.py fixtures/1.1/bad-objects/E001_invalid_version_format
[E001b] OCFL Object root contains unexpected directory: 1 (see https://ocfl.io/1.0/spec/#E001)
[E009] OCFL Object root inventory versions block does not contain v1 or a zero padded equivalent (see https://ocfl.io/1.0/spec/#E009)
[E042a] OCFL Object root inventory manifest includes invalid content path 1/content/my_content/dracula.txt (see https://ocfl.io/1.0/spec/#E042)
[E042a] OCFL Object root inventory manifest includes invalid content path 1/content/my_content/poe.txt (see https://ocfl.io/1.0/spec/#E042)
INFO:ocfl.object:OCFL v1.1 Object at fixtures/1.1/bad-objects/E001_invalid_version_format is INVALID

Having said that, if directory 1 is interpreted as a version directory then E104 is appropriate. This seems to be a case where the validation approach will determine the precise error.

@srerickson
Copy link
Contributor

For what it's worth, I've gone down the road of being overly pedantic about the fixture/error-code correspondence and I feel like my validation code suffered as a consequence. This message from the README is worth taking to heart:

Different validation strategies may find errors in different orders and possibly short-circuit other checks, thus not reporting the indicated error. Validators are expected to reject as invalid all fixture objects in bad-objects.

My validator gives E001, E008, and a currently unassigned error (that should be E104):

0 info  | 15:37:12.533113 | object includes invalid files or directories: 1 logger=../../testdata/object-fixtures/1.1/bad-objects/E001_invalid_version_format type=fatal OCFL=E001
0 info  | 15:37:12.533150 | no versions found              logger=../../testdata/object-fixtures/1.1/bad-objects/E001_invalid_version_format type=fatal OCFL=E008
0 info  | 15:37:12.533444 | error in inventory head field: 1: invalid version logger=../../testdata/object-fixtures/1.1/bad-objects/E001_invalid_version_format/inventory.json type=fatal
0 error | 15:37:12.533484 | path is not a valid OCFL object logger=../../testdata/object-fixtures/1.1/bad-objects/E001_invalid_version_format error="error in inventory head field: 1: invalid version"

@je4
Copy link
Author

je4 commented Oct 20, 2022

The main reason I raised this issue was, that I feel that constructing an example for E104 would look exactly like the one mentioned

@pwinckles
Copy link
Contributor

For what it's worth, I agree with @je4

$ rocfl validate -p 1.1/bad-objects/E001_invalid_version_format
Object urn:example is invalid
  Errors:
    1. [E104] (root) Inventory 'head' must be a valid version number. Found: 1
    2. [E099] (root) Inventory manifest key 'ffc150e7944b5cf5ddb899b2f48efffbd490f97632fc258434aefc4afb92aef2e3441ddcceae11404e5805e1b6c804083c9398c28f061c9ba42dd4bac53d5a2e' contains a path containing an illegal path part. Found: 1/content/my_content/dracula.txt
    3. [E099] (root) Inventory manifest key '69f54f2e9f4568f7df4a4c3b07e4cbda4ba3bba7913c5218add6dea891817a80ce829b877d7a84ce47f93cbad8aa522bf7dd8eda2778e16bdf3c47cf49ee3bdf' contains a path containing an illegal path part. Found: 1/content/my_content/poe.txt
    4. [E104] (root) Inventory 'versions' contains an invalid version number. Found: 1
    5. [E008] (root) Inventory does not contain any valid versions

I start with the root inventory as the source of truth. If the root inventory is not valid, I don't bother validating anything else.

@srerickson
Copy link
Contributor

By contrast, my validation starts with the object directory entries, which is why E001 is the first error to be raised. In any case, I would ok with renaming this to E104 since that error isn't represented in the fixtures and there are two others for E001.

@pwinckles
Copy link
Contributor

Yeah, it honestly does not matter to me what it's named. Like you said originally, validators will arrive at different codes based on strategy. What's important is that they all agree that it's invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants