mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 12:54:26 +01:00
bump utoipa to the latest rc and make the list key route compile
This commit is contained in:
parent
e9d74d424b
commit
4a1d4460bd
17
Cargo.lock
generated
17
Cargo.lock
generated
@ -3608,6 +3608,7 @@ dependencies = [
|
||||
"tracing",
|
||||
"ureq",
|
||||
"url",
|
||||
"utoipa",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
@ -5847,9 +5848,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||
|
||||
[[package]]
|
||||
name = "utoipa"
|
||||
version = "5.0.0-beta.0"
|
||||
version = "5.0.0-rc.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86fac56d240b49c629b9083c932ac20a23d926937e67c21ba209f836e2983d4f"
|
||||
checksum = "3cf66139459b75afa33caddb62bb2afee3838923b630b9e0ef38c369e543382f"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
@ -5859,9 +5860,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "utoipa-gen"
|
||||
version = "5.0.0-beta.0"
|
||||
version = "5.0.0-rc.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31d88270777931b8133b119c953062bd41665bb8507841f7d433f46d2765e9d4"
|
||||
checksum = "7c136da726bb82a527afa1fdf3f4619eaf104e2982f071f25239cef1c67c79eb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -5872,9 +5873,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "utoipa-rapidoc"
|
||||
version = "4.0.1-beta.0"
|
||||
version = "4.0.1-rc.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c836d406d590721b89f572cb0379479fcfbe27f31ca65c0775265a1b9026dd34"
|
||||
checksum = "a4d3324d5874fb734762214827dd30b47aa78510d12abab674a97f6d7c53688f"
|
||||
dependencies = [
|
||||
"actix-web",
|
||||
"serde",
|
||||
@ -5884,9 +5885,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "utoipa-scalar"
|
||||
version = "0.2.0-beta.0"
|
||||
version = "0.2.0-rc.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc86065a210b8540e46d15e0844765d1d14eec7fd6221c2b0de8f6edde990648"
|
||||
checksum = "7dc122c11f9642b20b3be88b60c1a3672319811f139698ac6999e72992ac7c7e"
|
||||
dependencies = [
|
||||
"actix-web",
|
||||
"serde",
|
||||
|
@ -37,7 +37,7 @@ time = { version = "0.3.36", features = [
|
||||
"macros",
|
||||
] }
|
||||
tokio = "1.38"
|
||||
utoipa = { version = "5.0.0-beta.0" }
|
||||
utoipa = { version = "5.0.0-rc.0", features = ["macros"] }
|
||||
uuid = { version = "1.10.0", features = ["serde", "v4"] }
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -16,7 +16,7 @@ use std::ops::Deref;
|
||||
use std::str::FromStr;
|
||||
|
||||
use deserr::{DeserializeError, Deserr, MergeWithError, ValueKind};
|
||||
use utoipa::ToSchema;
|
||||
use utoipa::{PartialSchema, ToSchema};
|
||||
|
||||
use super::{DeserrParseBoolError, DeserrParseIntError};
|
||||
use crate::index_uid::IndexUid;
|
||||
@ -30,8 +30,14 @@ use crate::tasks::{Kind, Status};
|
||||
#[derive(Default, Debug, Clone, Copy)]
|
||||
pub struct Param<T>(pub T);
|
||||
|
||||
impl<'a, T: ToSchema<'a>> ToSchema<'a> for Param<T> {
|
||||
fn schema() -> (&'a str, utoipa::openapi::RefOr<utoipa::openapi::schema::Schema>) {
|
||||
impl<T: ToSchema> ToSchema for Param<T> {
|
||||
fn name() -> std::borrow::Cow<'static, str> {
|
||||
T::name()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: PartialSchema> PartialSchema for Param<T> {
|
||||
fn schema() -> utoipa::openapi::RefOr<utoipa::openapi::schema::Schema> {
|
||||
T::schema()
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
use deserr::Deserr;
|
||||
use milli::OrderBy;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Deserr)]
|
||||
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Deserr, ToSchema)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[deserr(rename_all = camelCase)]
|
||||
pub enum FacetValuesSort {
|
||||
|
@ -1,8 +1,9 @@
|
||||
use deserr::Deserr;
|
||||
use milli::LocalizedAttributesRule;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Deserr, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Deserr, Serialize, Deserialize, ToSchema)]
|
||||
#[deserr(rename_all = camelCase)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct LocalizedAttributesRuleView {
|
||||
@ -33,7 +34,7 @@ impl From<LocalizedAttributesRuleView> for LocalizedAttributesRule {
|
||||
/// this enum implements `Deserr` in order to be used in the API.
|
||||
macro_rules! make_locale {
|
||||
($(($iso_639_1:ident, $iso_639_1_str:expr) => ($iso_639_3:ident, $iso_639_3_str:expr),)+) => {
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserr, Serialize, Deserialize, Ord, PartialOrd)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserr, Serialize, Deserialize, Ord, PartialOrd, ToSchema)]
|
||||
#[deserr(rename_all = camelCase)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum Locale {
|
||||
|
@ -40,10 +40,10 @@ where
|
||||
.serialize(s)
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, PartialEq, Eq)]
|
||||
#[derive(Clone, Default, Debug, Serialize, PartialEq, Eq, ToSchema)]
|
||||
pub struct Checked;
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize, PartialEq, Eq, ToSchema)]
|
||||
pub struct Unchecked;
|
||||
|
||||
impl<E> Deserr<E> for Unchecked
|
||||
@ -236,6 +236,7 @@ pub struct Settings<T> {
|
||||
/// Embedder required for performing meaning-based search queries.
|
||||
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
||||
#[deserr(default, error = DeserrJsonError<InvalidSettingsEmbedders>)]
|
||||
#[schema(value_type = String)] // TODO: TAMO
|
||||
pub embedders: Setting<BTreeMap<String, Setting<milli::vector::settings::EmbeddingSettings>>>,
|
||||
/// Maximum duration of a search query.
|
||||
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
||||
@ -244,6 +245,7 @@ pub struct Settings<T> {
|
||||
pub search_cutoff_ms: Setting<u64>,
|
||||
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
||||
#[deserr(default, error = DeserrJsonError<InvalidSettingsLocalizedAttributes>)]
|
||||
#[schema(value_type = Option<Vec<LocalizedAttributesRuleView>>, example = json!(50))]
|
||||
pub localized_attributes: Setting<Vec<LocalizedAttributesRuleView>>,
|
||||
|
||||
#[serde(skip)]
|
||||
@ -908,7 +910,7 @@ impl From<ProximityPrecisionView> for ProximityPrecision {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize, PartialEq, Eq, ToSchema)]
|
||||
#[derive(Debug, Clone, Default, Deserialize, PartialEq, Eq)]
|
||||
pub struct WildcardSetting(Setting<Vec<String>>);
|
||||
|
||||
impl From<Setting<Vec<String>>> for WildcardSetting {
|
||||
|
@ -104,9 +104,9 @@ tracing-trace = { version = "0.1.0", path = "../tracing-trace" }
|
||||
tracing-actix-web = "0.7.11"
|
||||
build-info = { version = "1.7.0", path = "../build-info" }
|
||||
roaring = "0.10.2"
|
||||
utoipa = { version = "5.0.0-beta.0", features = ["actix_extras", "non_strict_integers", "preserve_order", "uuid", "time", "openapi_extensions"] }
|
||||
utoipa-scalar = { version = "0.2.0-beta.0", features = ["actix-web"] }
|
||||
utoipa-rapidoc = { version = "4.0.1-beta.0", features = ["actix-web"] }
|
||||
utoipa = { version = "5.0.0-rc.0", features = ["actix_extras", "macros", "non_strict_integers", "preserve_order", "uuid", "time", "openapi_extensions"] }
|
||||
utoipa-scalar = { version = "0.2.0-rc.0", features = ["actix-web"] }
|
||||
utoipa-rapidoc = { version = "4.0.1-rc.0", features = ["actix-web"] }
|
||||
|
||||
[dev-dependencies]
|
||||
actix-rt = "2.10.0"
|
||||
|
@ -16,7 +16,7 @@ use time::OffsetDateTime;
|
||||
use utoipa::{IntoParams, OpenApi, ToSchema};
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::PAGINATION_DEFAULT_LIMIT;
|
||||
use super::{PaginationView, PAGINATION_DEFAULT_LIMIT};
|
||||
use crate::extractors::authentication::policies::*;
|
||||
use crate::extractors::authentication::GuardedData;
|
||||
use crate::extractors::sequential_extractor::SeqHandler;
|
||||
@ -134,6 +134,7 @@ impl ListApiKeys {
|
||||
/// Get API Keys
|
||||
///
|
||||
/// List all API Keys
|
||||
/// TODO: Tamo fix the return type
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/",
|
||||
@ -141,7 +142,7 @@ impl ListApiKeys {
|
||||
security(("Bearer" = ["keys.get", "keys.*", "*"])),
|
||||
params(ListApiKeys),
|
||||
responses(
|
||||
(status = 202, description = "List of keys", body = PaginationView<KeyView>, content_type = "application/json", example = json!(
|
||||
(status = 202, description = "List of keys", body = serde_json::Value, content_type = "application/json", example = json!(
|
||||
{
|
||||
"results": [
|
||||
{
|
||||
|
@ -256,6 +256,7 @@ pub struct IndexStats {
|
||||
/// Whether or not the index is currently ingesting document
|
||||
pub is_indexing: bool,
|
||||
/// Association of every field name with the number of times it occurs in the documents.
|
||||
#[schema(value_type = HashMap<String, u64>)]
|
||||
pub field_distribution: FieldDistribution,
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ use utoipa_rapidoc::RapiDoc;
|
||||
use utoipa_scalar::{Scalar, Servable as ScalarServable};
|
||||
|
||||
use self::api_key::KeyView;
|
||||
use self::api_key::ListApiKeys;
|
||||
use self::indexes::IndexStats;
|
||||
use self::logs::GetLogs;
|
||||
use self::logs::LogMode;
|
||||
@ -63,7 +62,7 @@ pub mod tasks;
|
||||
),
|
||||
paths(get_health, get_version, get_stats),
|
||||
modifiers(&OpenApiAuth),
|
||||
components(schemas(PaginationView<KeyView>, KeyView, Action, CreateApiKey, UpdateStderrLogs, LogMode, GetLogs, IndexStats, Stats, HealthStatus, HealthResponse, VersionResponse, Code, ErrorType, AllTasks, TaskView, Status, DetailsView, ResponseError, Settings<Unchecked>, Settings<Checked>, TypoSettings, MinWordSizeTyposSetting, FacetingSettings, PaginationSettings, SummarizedTaskView, Kind))
|
||||
components(schemas(KeyView, Action, CreateApiKey, UpdateStderrLogs, LogMode, GetLogs, IndexStats, Stats, HealthStatus, HealthResponse, VersionResponse, Code, ErrorType, AllTasks, TaskView, Status, DetailsView, ResponseError, Settings<Unchecked>, Settings<Checked>, TypoSettings, MinWordSizeTyposSetting, FacetingSettings, PaginationSettings, SummarizedTaskView, Kind))
|
||||
)]
|
||||
pub struct MeilisearchApi;
|
||||
|
||||
@ -141,6 +140,7 @@ pub fn is_dry_run(req: &HttpRequest, opt: &Opt) -> Result<bool, ResponseError> {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SummarizedTaskView {
|
||||
/// The task unique identifier.
|
||||
#[schema(value_type = u32)]
|
||||
task_uid: TaskId,
|
||||
/// The index affected by this task. May be `null` if the task is not linked to any index.
|
||||
index_uid: Option<String>,
|
||||
@ -171,8 +171,8 @@ pub struct Pagination {
|
||||
pub limit: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, ToSchema)]
|
||||
#[schema(rename_all = "camelCase")]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PaginationView<T> {
|
||||
pub results: Vec<T>,
|
||||
pub offset: usize,
|
||||
|
@ -86,6 +86,7 @@ tracing = "0.1.40"
|
||||
ureq = { version = "2.10.0", features = ["json"] }
|
||||
url = "2.5.2"
|
||||
rayon-par-bridge = "0.1.0"
|
||||
utoipa = { version = "5.0.0-rc.0", features = ["non_strict_integers", "preserve_order", "uuid", "time", "openapi_extensions"] }
|
||||
|
||||
[dev-dependencies]
|
||||
mimalloc = { version = "0.1.43", default-features = false }
|
||||
|
@ -2,6 +2,7 @@ use std::collections::HashMap;
|
||||
|
||||
use charabia::Language;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use crate::fields_ids_map::FieldsIdsMap;
|
||||
use crate::FieldId;
|
||||
@ -14,9 +15,10 @@ use crate::FieldId;
|
||||
/// The pattern `attribute_name*` matches any attribute name that starts with `attribute_name`.
|
||||
/// The pattern `*attribute_name` matches any attribute name that ends with `attribute_name`.
|
||||
/// The pattern `*attribute_name*` matches any attribute name that contains `attribute_name`.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ToSchema)]
|
||||
pub struct LocalizedAttributesRule {
|
||||
pub attribute_patterns: Vec<String>,
|
||||
#[schema(value_type = Vec<String>)]
|
||||
pub locales: Vec<Language>,
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ use itertools::{EitherOrBoth, Itertools};
|
||||
use roaring::RoaringBitmap;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use time::OffsetDateTime;
|
||||
use utoipa::{PartialSchema, ToSchema};
|
||||
|
||||
use super::del_add::DelAddOperation;
|
||||
use super::index_documents::{IndexDocumentsConfig, Transform};
|
||||
@ -39,6 +40,18 @@ pub enum Setting<T> {
|
||||
NotSet,
|
||||
}
|
||||
|
||||
impl<T: ToSchema> ToSchema for Setting<T> {
|
||||
fn name() -> std::borrow::Cow<'static, str> {
|
||||
T::name()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: PartialSchema> PartialSchema for Setting<T> {
|
||||
fn schema() -> utoipa::openapi::RefOr<utoipa::openapi::schema::Schema> {
|
||||
T::schema()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, E> Deserr<E> for Setting<T>
|
||||
where
|
||||
T: Deserr<E>,
|
||||
|
Loading…
Reference in New Issue
Block a user