From 7c9236084237718cb3a3b04be81a4151438b3e0c Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Mon, 23 Feb 2026 20:49:30 +0000 Subject: [PATCH] radicle: fix to schemars of DefaultSeedingPolicy Use `flatten` to remove the extraneous `Scope2` that shows up in the JSON schema of the Radicle `Config`. --- crates/radicle-cli/examples/rad-config.md | 26 ++++++++--------------- crates/radicle/src/node/config.rs | 1 + 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/crates/radicle-cli/examples/rad-config.md b/crates/radicle-cli/examples/rad-config.md index 9de6ab34..2e5ed570 100644 --- a/crates/radicle-cli/examples/rad-config.md +++ b/crates/radicle-cli/examples/rad-config.md @@ -614,18 +614,21 @@ $ rad config schema "description": "Allow seeding.", "type": "object", "properties": { - "scope": { - "description": "Seeding scope.", - "$ref": "#/$defs/Scope" - }, "default": { "type": "string", "const": "allow" } }, + "anyOf": [ + { + "$ref": "#/$defs/Scope" + }, + { + "type": "null" + } + ], "required": [ - "default", - "scope" + "default" ] }, { @@ -644,17 +647,6 @@ $ rad config schema ] }, "Scope": { - "description": "[`Scope`] provides a schema for [`policy::Scope`], where the inner scope is/noptional. It is introduced to allow ease migration to a future/nversion of [`DefaultSeedingPolicy::Allow`], where no or different defaults/napply to [`DefaultSeedingPolicy::Allow::scope`].", - "anyOf": [ - { - "$ref": "#/$defs/Scope2" - }, - { - "type": "null" - } - ] - }, - "Scope2": { "description": "Follow scope of a seeded repository.", "oneOf": [ { diff --git a/crates/radicle/src/node/config.rs b/crates/radicle/src/node/config.rs index 1171db02..f32449fe 100644 --- a/crates/radicle/src/node/config.rs +++ b/crates/radicle/src/node/config.rs @@ -373,6 +373,7 @@ pub enum DefaultSeedingPolicy { Allow { /// Seeding scope. #[serde(skip_serializing_if = "Scope::is_implicit")] + #[cfg_attr(feature = "schemars", schemars(flatten))] scope: Scope, }, /// Block seeding.