korpling / annatto

Converts linguistic data formats based on the graphANNIS data model as intermediate representation and can apply consistency tests.
Apache License 2.0
1 stars 0 forks source link

Improve `info` output #250

Closed MartinKl closed 1 week ago

MartinKl commented 2 weeks ago

The info function so far provides:

This should be extended to avoid overloading the description with information that could be derived automatically. This includes:

Adding these will help keep frustration by trial and error low.

MartinKl commented 2 weeks ago

The best solution to this problem might actually a code style convention for Annatto (maybe even some kind of doc string template for fields) that forces contributors to mention TYPE and IS_REQUIRED (or whatever) in the doc string.

Parsing field types and even worse, figuring out if they are required, seem to be sth undesirable in a language like Rust.

MartinKl commented 2 weeks ago

Another approach to think about a little bit is to refrain from using defaults for deserializable struct fields except for Option, thus using the latter would be a clear indicator of a field not being required. This, though, would have some weird implication for primitive types. bool as a type could be replaced by anything, since we'd only need to check for None vs. Some. For integer types, would we assume a difference between 0 and None or None always implies 0? As stated above, this needs some thinking about. On the contrary, we could not restrict types but always enforce there is a default, which does not work for path types (so we'd have to explicitly code around it) and does not make sense in all contexts (e. g. layer and name of annotation component arguments, the type usually can be thought of in default terms).

MartinKl commented 1 week ago

The current policy is to enforce default. Where defaut is not possible for fields, use Option