#![allow(clippy::unwrap_used, clippy::expect_used)]
const SPEC: &str = include_str!("../../../docs/api/openapi.yaml");
const ROUTER_PATHS: &[&str] = &[
"/v1/collections",
"/v1/collections/{name}",
"/v1/collections/{name}/points",
"/v1/collections/{name}/points:bulk",
"/v1/collections/{name}/points:text",
"/v1/collections/{name}/points/{id}",
"/v1/collections/{name}/query",
"/v1/collections/{name}/query/hybrid",
"/v1/collections/{name}/query/text",
"/v1/collections/{name}/fetch",
"/v1/collections/{name}/documents",
"/v1/collections/{name}/documents/query",
"/v1/snapshot",
"/cluster/map",
"/cluster/raft/voters",
"/cluster/raft/voters/{id}",
"/healthz",
"/readyz",
"/metrics",
];
#[test]
fn openapi_documents_every_rest_route() {
for p in ROUTER_PATHS {
assert!(
SPEC.contains(&format!("\n {p}:")),
"openapi.yaml is missing the route {p}"
);
}
}
#[test]
fn openapi_does_not_document_unimplemented_endpoints() {
for fiction in ["/query/batch", "/v1/keys", "/stats"] {
assert!(
!SPEC.contains(fiction),
"openapi.yaml documents the unimplemented endpoint {fiction}"
);
}
}