From c237a3fe479050691001ad7487c6ec151dbb797b Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Thu, 19 Mar 2026 00:31:18 +0100 Subject: [PATCH] radicle: Fix JSON Schema for `node::Address` JSON Schema generation via `schemars` was accidentally broken in `a2e72b4`. Restore the schema. --- crates/radicle/src/node.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/crates/radicle/src/node.rs b/crates/radicle/src/node.rs index 7500c42b..dce92dd9 100644 --- a/crates/radicle/src/node.rs +++ b/crates/radicle/src/node.rs @@ -433,21 +433,17 @@ impl TryFrom<&sqlite::Value> for Alias { derive(schemars::JsonSchema), schemars(description = "\ An IP address, or a DNS name, or a Tor onion name, followed by the symbol ':', \ - followed by a TCP port number.\ -") -)] -pub struct Address( - #[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" = [ + followed by a TCP port number.", + extend( + "examples" = [ "xmrhfasfg5suueegrnc4gsgyi2tyclcy5oz7f5drnrodmdtob6t2ioyd.onion:8776", "seed.example.com:8776", "192.0.2.0:31337", - ]), - ))] - NetAddr, -); + ], + "pattern" = "^.+:((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}))$", + ), +))] +pub struct Address(NetAddr); impl Address { /// Check whether this address is from the local network.