radicle-heartwood-lfs/radicle-cli
Fintan Halpenny adaed6a3ac
radicle: validated construction of Project
The `validate` method of `Project` was unused, which is problematic if
the attributes are supposed to be validated based on some
constraints. The issue is that `Project` provided public construction
of its fields with enforcing validation.

This change makes `Project`'s attributes private and introduces a
smart constructor `new` which is fallible if any of the constraints
are not met. The error type was changed to be a vector of errors since
all of these errors can be collected for better error reporting.

Deserialization also provided a way of constructing a `Project`
without ensuring any of the constraints were checked. To prevent this
a hand-rolled `Deserialize` is provided that goes through
`Project::new`.

To access the fields of `Project`, accessor functions are added and
all call sites are updated to use them.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-27 12:23:39 +01:00
..
examples cli: list your assigned issues via 'rad issue' 2022-12-26 15:52:14 +01:00
src radicle: validated construction of Project 2022-12-27 12:23:39 +01:00
tests cli: assign and unassign issues 2022-12-26 15:38:39 +01:00
Cargo.toml cli: Replace `trycmd` with our own test runner 2022-12-06 10:01:38 +01:00