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

Specification of validator error codes and messages #144

Closed
zimeon opened this issue Sep 10, 2018 · 12 comments
Closed

Specification of validator error codes and messages #144

zimeon opened this issue Sep 10, 2018 · 12 comments
Labels
Editorial Editorial issues (no changes to intent)

Comments

@zimeon
Copy link
Contributor

zimeon commented Sep 10, 2018

Rather than use the wiki to draft a set of error codes, I think we should start off with something machine readable. A JSON-LD file that can easily be extended for multilingual support might be good and we could use something as simple as:

{
  "@context": {
    "@version": 1.1,
    "id": "@id",
    "type": "@type",
    "@base": "https://ocfl.io/terms/validation/",
    "ocflv": "https://ocfl.io/terms/validation/",
    "errors": "ocflv:errors",
    "warnings": "ocflv:warnings",
    "info": "ocflv:info",
    "code": "@id",
    "section": "ocfl:section",
    "description": { "@id": "ocflv:description", "@container": "@language" }
  },
  "id": "ocflv:validation_codes",
  "errors": [
    {
      "code": "e001",
      "section": "https://ocfl.io/draft/spec/#object-conformance-declaration",
      "description": {
         "en": "Missing OCFL Namaste file",
         "zz": "Description in language zz"
      }
    },
    {
      "code": "e002",
      "section": "https://ocfl.io/draft/spec/#object-conformance-declaration",
      "description": {
         "en": "Namaste file name does not match OCFL Version"
      }
    }
  ]
}

and so on with blocks for "warnings" and "info". Something like this would be easy to use in code and also not too horrible as JSON-LD/RDF. We'd need to think a bit about how to maintain references to the specification but it would be quite easy to cut a version by putting the x.y in place of draft or lastest.

@zimeon zimeon added the Editorial Editorial issues (no changes to intent) label Sep 10, 2018
@zimeon
Copy link
Contributor Author

zimeon commented Sep 10, 2018

Can check triples for above in https://json-ld.org/playground-dev/

@ahankinson
Copy link
Contributor

Can we use the wiki to list the error codes, and then write them up in JSON?

@ahankinson
Copy link
Contributor

How do you imagine this working with a validator? Would it take this file as input? Would this mean the logic of figuring out the violation would be in software, but the error to raise would be in the configuration?

@ahankinson
Copy link
Contributor

But, in general, +1 to the suggestion!

@ahankinson
Copy link
Contributor

Also, how does this fit WRT JSON-Schema?

@zimeon
Copy link
Contributor Author

zimeon commented Sep 10, 2018

If I do any work on a validator I want to code only e001 etc. and then have a lookup for the text, hence the suggestion.

I'm not JSON-Schema expert but I think it would be trivial to write one for this if desired.

I think having the data in the code rather than the wiki is better because then we can use issues/PRs etc..

@ahankinson
Copy link
Contributor

Yeah, I'm in favour of having it in some sort of parse-able medium. I was just writing them on the wiki so that we can figure out what we need. I don't see them as the end-point (although it may be useful to generate some sort of human-readable list of error messages).

I'm just trying to figure out the mechanics.

@zimeon
Copy link
Contributor Author

zimeon commented Sep 10, 2018

Not intended as an answer to the above but maybe better to index by code instead, and type as Error/Warning/etc.:

{
  "@context": {
    "@version": 1.1,
    "id": "@id",
    "type": "@type",
    "@base": "https://ocfl.io/terms/validation/",
    "ocflv": "https://ocfl.io/terms/validation/",
    "Error": "ocflv:Error",
    "Warning": "ocflv:Warning",
    "Info": "ocflv:Info",
    "codes": {"@id": "ocflv:code", "@container": "@id"},
    "section": "ocfl:section",
    "description": { "@id": "ocflv:description", "@container": "@language" }
  },
  "id": "ocflv:validation_codes",
  "codes": {
    "e001": {
      "type": "Error",
      "section": "https://ocfl.io/draft/spec/#object-conformance-declaration",
      "description": {
         "en": "Missing OCFL Namaste file",
         "zz": "Description in language zz"
      }
    },
    "e002": {
      "type": "Error",
      "section": "https://ocfl.io/draft/spec/#object-conformance-declaration",
      "description": {
         "en": "Namaste file name does not match OCFL Version"
      }
    }
  }
}

@ahankinson
Copy link
Contributor

Yeah, that's better.

@ahankinson
Copy link
Contributor

Thinking further on this, I'm inclined to list out the error messages in the wiki first. It will be good to know whether we can match up what we think is an error with what we say in the spec (and identify any omissions either way).

Since the structure of the machine readable representation of these is still in flux, it would be good to save that until we can focus on software development and tooling. But I think this is definitely something we should do, and something we should write into the core of any validator(s).

@zimeon
Copy link
Contributor Author

zimeon commented Sep 11, 2018

OK, will mark defer for now. I'm working with the format in #144 (comment) for some trial work on validation at https://github.com/zimeon/ocfl-py/blob/master/ocfl/data/validation-errors.jsonld

@zimeon
Copy link
Contributor Author

zimeon commented Jul 16, 2019

Editors' discussion 2019-07-16 -- going to close this for now and instead focus on the simple list of error code for v1.0 and validator https://github.com/OCFL/spec/wiki/OCFL-Validators

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Editorial Editorial issues (no changes to intent)
Projects
None yet
Development

No branches or pull requests

2 participants