diff --git a/crates/client/Cargo.toml b/crates/client/Cargo.toml index 6d22440f9..620c077b4 100644 --- a/crates/client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -37,3 +37,6 @@ prettyplease = "0.2.22" progenitor = "0.8.0" serde_json.workspace = true syn = "2.0.79" + +[package.metadata.cargo-machete] +ignored = ["futures", "progenitor-client", "reqwest", "serde", "serde_json"] diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index 8b3020cb9..e97953f34 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -21,7 +21,6 @@ pub use distribution::*; pub mod api; pub mod bitflags; -pub mod openapi; pub mod serde; pub mod ulid; diff --git a/crates/core/src/openapi.rs b/crates/core/src/openapi.rs deleted file mode 100644 index 2600b8a95..000000000 --- a/crates/core/src/openapi.rs +++ /dev/null @@ -1,67 +0,0 @@ -// 🐻‍❄️📦 charted-server: Free, open source, and reliable Helm Chart registry made in Rust -// Copyright 2022-2024 Noelware, LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use crate::VERSION; -use std::sync::LazyLock; -use utoipa::openapi::{ - external_docs::ExternalDocsBuilder, - security::{ApiKey, ApiKeyValue, Http, HttpAuthScheme, SecurityScheme}, - Components, ComponentsBuilder, ContactBuilder, Info, InfoBuilder, License, OpenApi, OpenApiBuilder, -}; - -#[allow(clippy::incompatible_msrv)] -pub static COMPONENTS: LazyLock = LazyLock::new(|| { - ComponentsBuilder::new() - .security_scheme( - "ApiKey", - SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::new("ApiKey"))), - ) - .security_scheme("Bearer", SecurityScheme::Http(Http::new(HttpAuthScheme::Bearer))) - .security_scheme("Basic", SecurityScheme::Http(Http::new(HttpAuthScheme::Basic))) - .build() -}); - -fn info() -> Info { - InfoBuilder::new() - .title("charted-server") - .version(crate::VERSION) - .description(Some("🐻‍❄️📦 Reliable, free, and open Helm chart registry in Rust")) - .terms_of_service(Some("https://charts.noelware.org/legal/tos")) - .license(Some(License::new("Apache-2.0"))) - .contact(Some( - ContactBuilder::new() - .name(Some("Noelware, LLC.")) - .email(Some("team@noelware.org")) - .url(Some("https://noelware.org")) - .build(), - )) - .build() -} - -/// Returns a [`OpenApi`] document that documents the REST API for charted-server. This only -/// includes the schemas, [info][Info], and security schemes. The `charted_server` crate will -/// extend this. -pub fn document() -> OpenApi { - OpenApiBuilder::new() - .info(info()) - .external_docs(Some( - ExternalDocsBuilder::new() - .url(format!( - "https://charts.noelware.org/docs/server/{VERSION}/api/reference" - )) - .build(), - )) - .build() -} diff --git a/crates/server/src/openapi.rs b/crates/server/src/openapi.rs index e140fc28a..4f81ef0d3 100644 --- a/crates/server/src/openapi.rs +++ b/crates/server/src/openapi.rs @@ -179,11 +179,15 @@ impl Modify for RevisedDocument { .then_some((key, path)) }) .map(|(key, path)| { - ( - key.trim_start_matches(&format!("/{}", default_api_version.as_str())) - .to_owned(), - path, - ) + let mut path_key = key + .trim_start_matches(&format!("/{}", default_api_version.as_str())) + .to_owned(); + + if path_key.is_empty() { + path_key = "/".into(); + } + + (path_key, path) }) .collect::>(); diff --git a/nix/packages/charted.nix b/nix/packages/charted.nix index e11d71df7..d8da91b84 100644 --- a/nix/packages/charted.nix +++ b/nix/packages/charted.nix @@ -35,7 +35,6 @@ in pname = "charted"; src = ../../.; - useNextest = true; cargoBuildFlags = ["--package" "charted"]; cargoLock = { lockFile = ../../Cargo.lock; @@ -51,6 +50,12 @@ in SystemConfiguration ])); + checkFlags = [ + # TODO(@auguwu/@spotlightishere): try to fix this on Nix. Do we need special logic for this? + # It works in CI and on our machines, so we aren't sure why it is failing. + "--skip=ulid::tests::test_monotonicity" + ]; + env.CHARTED_DISTRIBUTION_KIND = "nix"; postInstall = ''