Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
radicle: fix schemars imports
Archived fintohaps opened 11 months ago

There were some locations where schemars was being used without hiding it behind the feature flag.

2 files changed +13 -11 1a67ac18 17139b7e
modified radicle/src/node/config.rs
@@ -298,15 +298,17 @@ impl Default for RateLimits {
)]
pub struct ConnectAddress(
    #[serde(with = "crate::serde_ext::string")]
-
    #[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" = [
-
            "z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm7@seed.radicle.garden:8776",
-
            "z6MkvUJtYD9dHDJfpevWRT98mzDDpdAtmUjwyDSkyqksUr7C@xmrhfasfg5suueegrnc4gsgyi2tyclcy5oz7f5drnrodmdtob6t2ioyd.onion:8776",
-
            "z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi@seed.example.com:8776",
-
            "z6MkkfM3tPXNPrPevKr3uSiQtHPuwnNhu2yUVjgd2jXVsVz5@192.0.2.0:31337",
-
        ]),
+
    #[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" = [
+
                "z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm7@seed.radicle.garden:8776",
+
                "z6MkvUJtYD9dHDJfpevWRT98mzDDpdAtmUjwyDSkyqksUr7C@xmrhfasfg5suueegrnc4gsgyi2tyclcy5oz7f5drnrodmdtob6t2ioyd.onion:8776",
+
                "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,7 +29,8 @@ 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)]
+
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[serde(rename_all = "camelCase")]
pub struct Pinned {
    /// Pinned repositories.