Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
radicle: fix build when schemars feature is not enabled
Merged did:key:z6Mkm3WR...9jjY opened 11 months ago

Commit b608a788 (cli: rad config schema emits JSON Schema, 2025-04-28) added a feature flag that enables the “schemars” optional dependency.

Crate radicle-node doesn’t use this feature. Crate radicle fails to compile when the feature is disabled. This is reproducible with “flake check”. Fix it.

Note that a “cargo build” of the entire workspace doesn’t fail, because the feature is enabled due to “unification”, since “radicle-cli” does use this feature. From https://doc.rust-lang.org/cargo/reference/resolver.html#features:

When building multiple packages in a workspace (such as with –workspace or multiple -p flags), the features [of the dependencies] of all of those packages are unified. If you have a circumstance where you want to avoid that unification for different workspace members, you will need to build them via separate cargo invocations.

2 files changed +4 -4 1a67ac18 059c8045
modified radicle/src/node/config.rs
@@ -298,7 +298,7 @@ impl Default for RateLimits {
)]
pub struct ConnectAddress(
    #[serde(with = "crate::serde_ext::string")]
-
    #[schemars(
+
    #[cfg_attr(feature = "schemars", schemars(
        with = "String",
        regex(pattern = r"^.+@.+:((6553[0-5])|(655[0-2][0-9])|(65[0-4][0-9]{2})|(6[0-4][0-9]{3})|([1-5][0-9]{4})|([0-5]{0,5})|([0-9]{1,4}))$"),
        extend("examples" = [
@@ -307,7 +307,7 @@ pub struct ConnectAddress(
            "z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi@seed.example.com:8776",
            "z6MkkfM3tPXNPrPevKr3uSiQtHPuwnNhu2yUVjgd2jXVsVz5@192.0.2.0:31337",
        ]),
-
    )]
+
    ))]
    PeerAddr<NodeId, Address>,
);

modified radicle/src/web.rs
@@ -1,5 +1,4 @@
use crate::prelude::RepoId;
-
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::collections::HashSet;

@@ -30,8 +29,9 @@ pub struct Config {

/// Pinned content. This can be used to pin certain content when
/// listing, e.g. pin repositories on a web client.
-
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema)]
+
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
+
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct Pinned {
    /// Pinned repositories.
    pub repositories: HashSet<RepoId>,