ontodev / valve.rs

A lightweight validation engine written in rust.
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Possible bug: No messages generated with datatype lacks a description #50

Closed jamesaoverton closed 1 year ago

jamesaoverton commented 1 year ago

When the 'description' column of the 'datatype' field is empty, no messages seem to be generated by VALVE.

lmcmicu commented 1 year ago

It seems to be fine as long as the datatype has a parent whose description is not empty. For instance in valve's test data this is the case for the label datatype. It has no description but its parent, trimmed line has a description which is used for messages. See, e.g., https://github.com/ontodev/valve.rs/blob/main/test/expected/messages.tsv#L17.

It also seems fine in the case where the datatype of the column has no description, but where the error message is not for a datatype error but something else (e.g., violation of a unique constraint). See, e.g., https://github.com/ontodev/valve.rs/blob/main/test/expected/messages.tsv#L35

The remaining case, which I think is the likely case where you are seeing this bug, is the case, specifically, of a datatype error for a datatype that has no description nor any parent that has a description. In valve's test data, the datatype text is an example.

jamesaoverton commented 1 year ago

Ok. Silently dropping messages is not good behaviour, so I see a few options:

  1. make 'description' required
  2. make a top-level description required
  3. default to the name of the datatype if no description is provided

What do you think?

lmcmicu commented 1 year ago

Option 3 seems to me like the obvious choice. Further, the generated error message would look like: "<column X> should be a <datatype name>", which to me sounds totally natural.