From c4c8b6545e9beae98fd9136a5cb2a71008fe8bd8 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 12 Dec 2024 05:31:30 +0000 Subject: [PATCH 1/2] Shift edition to 2024 and upgrade schemars Schemars is the big thing we need for 2024 edition due to it needing to rename the gen module. See https://github.com/kube-rs/kube/issues/1663 Hopefully they'll have a 1.0 release properly soon. Signed-off-by: clux --- Cargo.toml | 6 +++--- kube-derive/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 14fc4e283..4546750e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,8 +23,8 @@ authors = [ repository = "https://github.com/kube-rs/kube" readme = "README.md" license = "Apache-2.0" -edition = "2021" -rust-version = "1.77.2" +edition = "2024" +rust-version = "1.85.0" [workspace.lints.rust] unsafe_code = "forbid" @@ -70,7 +70,7 @@ quote = "1.0.10" rand = "0.8.3" rustls = { version = "0.23.16", default-features = false } rustls-pemfile = "2.0.0" -schemars = "0.8.6" +schemars = { version = "1.0.0-alpha.17" } secrecy = "0.10.2" serde = "1.0.130" serde_json = "1.0.68" diff --git a/kube-derive/Cargo.toml b/kube-derive/Cargo.toml index 0b89ea2f0..9177b927b 100644 --- a/kube-derive/Cargo.toml +++ b/kube-derive/Cargo.toml @@ -29,7 +29,7 @@ serde = { workspace = true, features = ["derive"] } serde_yaml.workspace = true kube = { path = "../kube", version = "<1.0.0, >=0.61.0", features = ["derive", "client"] } k8s-openapi = { workspace = true, features = ["latest"] } -schemars = { workspace = true, features = ["chrono"] } +schemars = { workspace = true, features = ["chrono04"] } chrono.workspace = true trybuild.workspace = true assert-json-diff.workspace = true From 6ce88e0be2d2b6c4515054bcf90b5b3864cdb892 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 12 Dec 2024 05:42:08 +0000 Subject: [PATCH 2/2] fix a few trivial breaking changes Signed-off-by: clux --- kube-core/src/duration.rs | 6 +++--- kube-core/src/schema.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kube-core/src/duration.rs b/kube-core/src/duration.rs index b958a1f51..4376b7944 100644 --- a/kube-core/src/duration.rs +++ b/kube-core/src/duration.rs @@ -273,15 +273,15 @@ impl PartialOrd for Duration { impl schemars::JsonSchema for Duration { // see // https://github.com/kubernetes/apimachinery/blob/756e2227bf3a486098f504af1a0ffb736ad16f4c/pkg/apis/meta/v1/duration.go#L61 - fn schema_name() -> String { - "Duration".to_owned() + fn schema_name() -> std::borrow::Cow<'static, str> { + "Duration" } fn is_referenceable() -> bool { false } - fn json_schema(_: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + fn json_schema(_: &mut schemars::generate::SchemaGenerator) -> schemars::schema::Schema { schemars::schema::SchemaObject { instance_type: Some(schemars::schema::InstanceType::String.into()), // the format should *not* be "duration", because "duration" means diff --git a/kube-core/src/schema.rs b/kube-core/src/schema.rs index 5cdcd84ab..71c9f9e7d 100644 --- a/kube-core/src/schema.rs +++ b/kube-core/src/schema.rs @@ -3,7 +3,7 @@ //! [`CustomResourceDefinition`]: `k8s_openapi::apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinition` // Used in docs -#[allow(unused_imports)] use schemars::gen::SchemaSettings; +#[allow(unused_imports)] use schemars::generate::SchemaSettings; use schemars::{ schema::{InstanceType, Metadata, ObjectValidation, Schema, SchemaObject, SingleOrVec},