Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions crates/uv-resolver/src/exclude_newer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,14 +436,33 @@ impl std::fmt::Display for ExcludeNewerValue {
/// This enum represents whether exclude-newer should be disabled for a package,
/// or if a specific cutoff (absolute or relative) should be used.
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub enum PackageExcludeNewer {
/// Disable exclude-newer for this package (allow all versions regardless of upload date).
Disabled,
/// Enable exclude-newer with this cutoff for this package.
Enabled(Box<ExcludeNewerValue>),
}

#[cfg(feature = "schemars")]
impl schemars::JsonSchema for PackageExcludeNewer {
fn schema_name() -> Cow<'static, str> {
Cow::Borrowed("PackageExcludeNewer")
}

fn json_schema(generator: &mut schemars::generate::SchemaGenerator) -> schemars::Schema {
schemars::json_schema!({
"oneOf": [
{
"type": "boolean",
"const": false,
"description": "Disable exclude-newer for this package."
},
generator.subschema_for::<ExcludeNewerValue>(),
]
})
}
}

/// A package-specific exclude-newer entry.
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
Expand Down Expand Up @@ -804,7 +823,7 @@ impl std::fmt::Display for ExcludeNewer {
#[cfg(feature = "schemars")]
impl schemars::JsonSchema for ExcludeNewerValue {
fn schema_name() -> Cow<'static, str> {
Cow::Borrowed("ExcludeNewerTimestamp")
Cow::Borrowed("ExcludeNewerValue")
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: renamed this since the Rust type itself was renamed (presumably in an earlier refactor).

}

fn json_schema(_generator: &mut schemars::generate::SchemaGenerator) -> schemars::Schema {
Expand Down
23 changes: 7 additions & 16 deletions uv.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading