Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shift edition to 2024 and upgrade schemars #1664

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions kube-core/src/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,17 +273,17 @@
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
}

Check failure on line 282 in kube-core/src/duration.rs

View workflow job for this annotation

GitHub Actions / clippy_nightly

method `is_referenceable` is not a member of trait `schemars::JsonSchema`

error[E0407]: method `is_referenceable` is not a member of trait `schemars::JsonSchema` --> kube-core/src/duration.rs:280:5 | 280 | / fn is_referenceable() -> bool { 281 | | false 282 | | } | |_____^ not a member of trait `schemars::JsonSchema`

fn json_schema(_: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
fn json_schema(_: &mut schemars::generate::SchemaGenerator) -> schemars::schema::Schema {

Check failure on line 284 in kube-core/src/duration.rs

View workflow job for this annotation

GitHub Actions / clippy_nightly

module `schema` is private

error[E0603]: module `schema` is private --> kube-core/src/duration.rs:284:78 | 284 | fn json_schema(_: &mut schemars::generate::SchemaGenerator) -> schemars::schema::Schema { | ^^^^^^ private module | note: the module `schema` is defined here --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/schemars-1.0.0-alpha.17/src/lib.rs:24:1 | 24 | mod schema; | ^^^^^^^^^^ help: consider importing this struct instead | 284 | fn json_schema(_: &mut schemars::generate::SchemaGenerator) -> schemars::Schema { | ~~~~~~~~~~~~~~~~
schemars::schema::SchemaObject {

Check failure on line 285 in kube-core/src/duration.rs

View workflow job for this annotation

GitHub Actions / clippy_nightly

cannot find struct, variant or union type `SchemaObject` in `schemars::schema`

error[E0422]: cannot find struct, variant or union type `SchemaObject` in `schemars::schema` --> kube-core/src/duration.rs:285:27 | 285 | schemars::schema::SchemaObject { | ^^^^^^^^^^^^ not found in `schemars::schema`

Check failure on line 285 in kube-core/src/duration.rs

View workflow job for this annotation

GitHub Actions / clippy_nightly

module `schema` is private

error[E0603]: module `schema` is private --> kube-core/src/duration.rs:285:19 | 285 | schemars::schema::SchemaObject { | ^^^^^^ private module | note: the module `schema` is defined here --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/schemars-1.0.0-alpha.17/src/lib.rs:24:1 | 24 | mod schema; | ^^^^^^^^^^
instance_type: Some(schemars::schema::InstanceType::String.into()),

Check failure on line 286 in kube-core/src/duration.rs

View workflow job for this annotation

GitHub Actions / clippy_nightly

failed to resolve: could not find `InstanceType` in `schema`

error[E0433]: failed to resolve: could not find `InstanceType` in `schema` --> kube-core/src/duration.rs:286:51 | 286 | instance_type: Some(schemars::schema::InstanceType::String.into()), | ^^^^^^^^^^^^ could not find `InstanceType` in `schema`
// the format should *not* be "duration", because "duration" means
// the duration is formatted in ISO 8601, as described here:
// https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-02#section-7.3.1
Expand Down
2 changes: 1 addition & 1 deletion kube-core/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
//! [`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},

Check failure on line 9 in kube-core/src/schema.rs

View workflow job for this annotation

GitHub Actions / clippy_nightly

unresolved imports `schemars::schema::InstanceType`, `schemars::schema::Metadata`, `schemars::schema::ObjectValidation`, `schemars::schema::SchemaObject`, `schemars::schema::SingleOrVec`, `schemars::visit`, `schemars::MapEntry`

error[E0432]: unresolved imports `schemars::schema::InstanceType`, `schemars::schema::Metadata`, `schemars::schema::ObjectValidation`, `schemars::schema::SchemaObject`, `schemars::schema::SingleOrVec`, `schemars::visit`, `schemars::MapEntry` --> kube-core/src/schema.rs:9:14 | 9 | schema::{InstanceType, Metadata, ObjectValidation, Schema, SchemaObject, SingleOrVec}, | ^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^ no `SingleOrVec` in `schema` | | | | | | | | | no `SchemaObject` in `schema` | | | no `ObjectValidation` in `schema` | | no `Metadata` in `schema` | no `InstanceType` in `schema` 10 | visit::Visitor, | ^^^^^ could not find `visit` in `schemars` 11 | MapEntry, | ^^^^^^^^ no `MapEntry` in the root | = help: consider importing one of these items instead: std::fs::Metadata k8s_openapi::Metadata

Check failure on line 9 in kube-core/src/schema.rs

View workflow job for this annotation

GitHub Actions / clippy_nightly

module `schema` is private

error[E0603]: module `schema` is private --> kube-core/src/schema.rs:9:5 | 9 | schema::{InstanceType, Metadata, ObjectValidation, Schema, SchemaObject, SingleOrVec}, | ^^^^^^ private module | note: the module `schema` is defined here --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/schemars-1.0.0-alpha.17/src/lib.rs:24:1 | 24 | mod schema; | ^^^^^^^^^^
visit::Visitor,
MapEntry,
};
Expand All @@ -29,8 +29,8 @@
pub struct StructuralSchemaRewriter;

impl Visitor for StructuralSchemaRewriter {
fn visit_schema_object(&mut self, schema: &mut schemars::schema::SchemaObject) {

Check failure on line 32 in kube-core/src/schema.rs

View workflow job for this annotation

GitHub Actions / clippy_nightly

cannot find type `SchemaObject` in `schemars::schema`

error[E0412]: cannot find type `SchemaObject` in `schemars::schema` --> kube-core/src/schema.rs:32:70 | 32 | fn visit_schema_object(&mut self, schema: &mut schemars::schema::SchemaObject) { | ^^^^^^^^^^^^ not found in `schemars::schema`

Check failure on line 32 in kube-core/src/schema.rs

View workflow job for this annotation

GitHub Actions / clippy_nightly

module `schema` is private

error[E0603]: module `schema` is private --> kube-core/src/schema.rs:32:62 | 32 | fn visit_schema_object(&mut self, schema: &mut schemars::schema::SchemaObject) { | ^^^^^^ private module | note: the module `schema` is defined here --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/schemars-1.0.0-alpha.17/src/lib.rs:24:1 | 24 | mod schema; | ^^^^^^^^^^
schemars::visit::visit_schema_object(self, schema);

Check failure on line 33 in kube-core/src/schema.rs

View workflow job for this annotation

GitHub Actions / clippy_nightly

failed to resolve: could not find `visit` in `schemars`

error[E0433]: failed to resolve: could not find `visit` in `schemars` --> kube-core/src/schema.rs:33:19 | 33 | schemars::visit::visit_schema_object(self, schema); | ^^^^^ could not find `visit` in `schemars`

if let Some(subschemas) = &mut schema.subschemas {
if let Some(one_of) = subschemas.one_of.as_mut() {
Expand Down
2 changes: 1 addition & 1 deletion kube-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading