radicle: fix to schemars of DefaultSeedingPolicy

Use `flatten` to remove the extraneous `Scope2` that shows up in the
JSON schema of the Radicle `Config`.
This commit is contained in:
Fintan Halpenny 2026-02-23 20:49:30 +00:00 committed by Lorenz Leutgeb
parent 6291cae592
commit 7c92360842
2 changed files with 10 additions and 17 deletions

View File

@ -614,18 +614,21 @@ $ rad config schema
"description": "Allow seeding.", "description": "Allow seeding.",
"type": "object", "type": "object",
"properties": { "properties": {
"scope": {
"description": "Seeding scope.",
"$ref": "#/$defs/Scope"
},
"default": { "default": {
"type": "string", "type": "string",
"const": "allow" "const": "allow"
} }
}, },
"anyOf": [
{
"$ref": "#/$defs/Scope"
},
{
"type": "null"
}
],
"required": [ "required": [
"default", "default"
"scope"
] ]
}, },
{ {
@ -644,17 +647,6 @@ $ rad config schema
] ]
}, },
"Scope": { "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.", "description": "Follow scope of a seeded repository.",
"oneOf": [ "oneOf": [
{ {

View File

@ -373,6 +373,7 @@ pub enum DefaultSeedingPolicy {
Allow { Allow {
/// Seeding scope. /// Seeding scope.
#[serde(skip_serializing_if = "Scope::is_implicit")] #[serde(skip_serializing_if = "Scope::is_implicit")]
#[cfg_attr(feature = "schemars", schemars(flatten))]
scope: Scope, scope: Scope,
}, },
/// Block seeding. /// Block seeding.