radicle: Fix JSON Schema for `node::Address`

JSON Schema generation via `schemars` was accidentally broken in
`a2e72b4`. Restore the schema.
This commit is contained in:
Lorenz Leutgeb 2026-03-19 00:31:18 +01:00
parent 9fd4f00c23
commit c237a3fe47
No known key found for this signature in database
1 changed files with 8 additions and 12 deletions

View File

@ -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<HostName>,
);
],
"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<HostName>);
impl Address {
/// Check whether this address is from the local network.