cli: verification of project for json errors only

An `xyz.radicle.project` payload is allowed to not be defined, so report the
error if the project resulted in a JSON error.
This commit is contained in:
Fintan Halpenny 2024-11-06 14:59:11 +00:00 committed by cloudhead
parent f9c3523183
commit c6d975799a
No known key found for this signature in database
2 changed files with 6 additions and 6 deletions

View File

@ -74,5 +74,5 @@ Note that we cannot delete mandatory fields:
``` (fails)
$ rad id update --title "Delete default branch" --payload xyz.radicle.project defaultBranch null
✗ Error: failed to verify `xyz.radicle.project`, json: missing field `defaultBranch`
✗ Error: failed to verify `xyz.radicle.project`, missing field `defaultBranch`
```

View File

@ -460,13 +460,13 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
anyhow::bail!("payload `{id}` not found in identity document");
}
}
// Verify that the project payload can still be parsed into the
// `Project` type.
if let Err(e) = proposal.project() {
anyhow::bail!("failed to verify `xyz.radicle.project`, {e}");
}
proposal
};
// Verify that the project payload can still be parsed into the
// `Project` type.
if let Err(PayloadError::Json(e)) = proposal.project() {
anyhow::bail!("failed to verify `xyz.radicle.project`, {e}");
}
let proposal = proposal.verified()?;
if proposal == current.doc {
if !options.quiet {