review all the parameters and tags

This commit is contained in:
Tamo 2024-12-26 18:44:08 +01:00
parent aab6ffec30
commit 5f55e88484
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69
5 changed files with 25 additions and 23 deletions

View File

@ -208,7 +208,7 @@ pub async fn list_api_keys(
/// Get an API key from its `uid` or its `key` field. /// Get an API key from its `uid` or its `key` field.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/{key}", path = "/{uidOrKey}",
tag = "Keys", tag = "Keys",
security(("Bearer" = ["keys.get", "keys.*", "*"])), security(("Bearer" = ["keys.get", "keys.*", "*"])),
params(("uidOrKey" = String, Path, format = Password, example = "7b198a7f-52a0-4188-8762-9ad93cd608b2", description = "The `uid` or `key` field of an existing API key", nullable = false)), params(("uidOrKey" = String, Path, format = Password, example = "7b198a7f-52a0-4188-8762-9ad93cd608b2", description = "The `uid` or `key` field of an existing API key", nullable = false)),
@ -275,7 +275,7 @@ pub async fn get_api_key(
/// If there is an issue with the `key` or `uid` of a key, then you must recreate one from scratch. /// If there is an issue with the `key` or `uid` of a key, then you must recreate one from scratch.
#[utoipa::path( #[utoipa::path(
patch, patch,
path = "/{key}", path = "/{uidOrKey}",
tag = "Keys", tag = "Keys",
security(("Bearer" = ["keys.update", "keys.*", "*"])), security(("Bearer" = ["keys.update", "keys.*", "*"])),
params(("uidOrKey" = String, Path, format = Password, example = "7b198a7f-52a0-4188-8762-9ad93cd608b2", description = "The `uid` or `key` field of an existing API key", nullable = false)), params(("uidOrKey" = String, Path, format = Password, example = "7b198a7f-52a0-4188-8762-9ad93cd608b2", description = "The `uid` or `key` field of an existing API key", nullable = false)),
@ -345,7 +345,7 @@ pub async fn patch_api_key(
/// If there is an issue with the `key` or `uid` of a key, then you must recreate one from scratch. /// If there is an issue with the `key` or `uid` of a key, then you must recreate one from scratch.
#[utoipa::path( #[utoipa::path(
delete, delete,
path = "/{key}", path = "/{uidOrKey}",
tag = "Keys", tag = "Keys",
security(("Bearer" = ["keys.delete", "keys.*", "*"])), security(("Bearer" = ["keys.delete", "keys.*", "*"])),
params(("uidOrKey" = String, Path, format = Password, example = "7b198a7f-52a0-4188-8762-9ad93cd608b2", description = "The `uid` or `key` field of an existing API key", nullable = false)), params(("uidOrKey" = String, Path, format = Password, example = "7b198a7f-52a0-4188-8762-9ad93cd608b2", description = "The `uid` or `key` field of an existing API key", nullable = false)),

View File

@ -177,12 +177,10 @@ impl Aggregate for FacetSearchAggregator {
/// Search for a facet value within a given facet. /// Search for a facet value within a given facet.
#[utoipa::path( #[utoipa::path(
post, post,
path = "/{indexUid}/facet-search", path = "{indexUid}/facet-search",
tags = ["Indexes", "Facet Search"], tag = "Facet Search",
security(("Bearer" = ["search", "*"])), security(("Bearer" = ["search", "*"])),
params( params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)),
("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false),
),
request_body = FacetSearchQuery, request_body = FacetSearchQuery,
responses( responses(
(status = 200, description = "The documents are returned", body = SearchResult, content_type = "application/json", example = json!( (status = 200, description = "The documents are returned", body = SearchResult, content_type = "application/json", example = json!(

View File

@ -110,7 +110,7 @@ impl IndexView {
#[derive(Deserr, Debug, Clone, Copy, IntoParams)] #[derive(Deserr, Debug, Clone, Copy, IntoParams)]
#[deserr(error = DeserrQueryParamError, rename_all = camelCase, deny_unknown_fields)] #[deserr(error = DeserrQueryParamError, rename_all = camelCase, deny_unknown_fields)]
#[into_params(rename_all = "camelCase")] #[into_params(rename_all = "camelCase", parameter_in = Query)]
pub struct ListIndexes { pub struct ListIndexes {
/// The number of indexes to skip before starting to retrieve anything /// The number of indexes to skip before starting to retrieve anything
#[param(value_type = Option<usize>, default, example = 100)] #[param(value_type = Option<usize>, default, example = 100)]
@ -515,7 +515,7 @@ impl From<index_scheduler::IndexStats> for IndexStats {
#[utoipa::path( #[utoipa::path(
get, get,
path = "/{indexUid}/stats", path = "/{indexUid}/stats",
tags = ["Indexes", "Stats"], tag = "Stats",
security(("Bearer" = ["stats.get", "stats.*", "*"])), security(("Bearer" = ["stats.get", "stats.*", "*"])),
params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)), params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)),
responses( responses(

View File

@ -85,8 +85,9 @@ macro_rules! make_setting_route {
#[utoipa::path( #[utoipa::path(
delete, delete,
path = concat!("{indexUid}/settings", $route), path = concat!("{indexUid}/settings", $route),
tags = ["Indexes", "Settings"], tag = "Settings",
security(("Bearer" = ["settings.update", "settings.*", "*"])), security(("Bearer" = ["settings.update", "settings.*", "*"])),
params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)),
request_body = $type, request_body = $type,
responses( responses(
(status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!(
@ -146,8 +147,9 @@ macro_rules! make_setting_route {
#[utoipa::path( #[utoipa::path(
$update_verb, $update_verb,
path = concat!("{indexUid}/settings", $route), path = concat!("{indexUid}/settings", $route),
tags = ["Indexes", "Settings"], tag = "Settings",
security(("Bearer" = ["settings.update", "settings.*", "*"])), security(("Bearer" = ["settings.update", "settings.*", "*"])),
params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)),
request_body = $type, request_body = $type,
responses( responses(
(status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!(
@ -229,8 +231,9 @@ macro_rules! make_setting_route {
#[utoipa::path( #[utoipa::path(
get, get,
path = concat!("{indexUid}/settings", $route), path = concat!("{indexUid}/settings", $route),
tags = ["Indexes", "Settings"], tag = "Settings",
security(("Bearer" = ["settings.get", "settings.*", "*"])), security(("Bearer" = ["settings.get", "settings.*", "*"])),
params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)),
request_body = $type, request_body = $type,
responses( responses(
(status = 200, description = concat!($camelcase_attr, " is returned"), body = SummarizedTaskView, content_type = "application/json", example = json!( (status = 200, description = concat!($camelcase_attr, " is returned"), body = SummarizedTaskView, content_type = "application/json", example = json!(
@ -500,8 +503,9 @@ make_setting_routes!(
#[utoipa::path( #[utoipa::path(
patch, patch,
path = "{indexUid}/settings", path = "{indexUid}/settings",
tags = ["Indexes", "Settings"], tag = "Settings",
security(("Bearer" = ["settings.update", "settings.*", "*"])), security(("Bearer" = ["settings.update", "settings.*", "*"])),
params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)),
request_body = Settings<Unchecked>, request_body = Settings<Unchecked>,
responses( responses(
(status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!(
@ -609,8 +613,9 @@ pub async fn update_all(
#[utoipa::path( #[utoipa::path(
get, get,
path = "{indexUid}/settings", path = "{indexUid}/settings",
tags = ["Indexes", "Settings"], tag = "Settings",
security(("Bearer" = ["settings.update", "settings.*", "*"])), security(("Bearer" = ["settings.update", "settings.*", "*"])),
params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)),
responses( responses(
(status = 200, description = "Settings are returned", body = Settings<Unchecked>, content_type = "application/json", example = json!( (status = 200, description = "Settings are returned", body = Settings<Unchecked>, content_type = "application/json", example = json!(
Settings::<Unchecked>::default() Settings::<Unchecked>::default()
@ -644,8 +649,9 @@ pub async fn get_all(
#[utoipa::path( #[utoipa::path(
delete, delete,
path = "{indexUid}/settings", path = "{indexUid}/settings",
tags = ["Indexes", "Settings"], tag = "Settings",
security(("Bearer" = ["settings.update", "settings.*", "*"])), security(("Bearer" = ["settings.update", "settings.*", "*"])),
params(("indexUid", example = "movies", description = "Index Unique Identifier", nullable = false)),
responses( responses(
(status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!( (status = 200, description = "Task successfully enqueued", body = SummarizedTaskView, content_type = "application/json", example = json!(
{ {

View File

@ -51,8 +51,8 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
/// Retrieve documents similar to a specific search result. /// Retrieve documents similar to a specific search result.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/{indexUid}/similar", path = "{indexUid}/similar",
tags = ["Indexes", "Similar documents"], tag = "Similar documents",
security(("Bearer" = ["search", "*"])), security(("Bearer" = ["search", "*"])),
params( params(
("indexUid" = String, Path, example = "movies", description = "Index Unique Identifier", nullable = false), ("indexUid" = String, Path, example = "movies", description = "Index Unique Identifier", nullable = false),
@ -135,12 +135,10 @@ pub async fn similar_get(
/// Retrieve documents similar to a specific search result. /// Retrieve documents similar to a specific search result.
#[utoipa::path( #[utoipa::path(
post, post,
path = "/{indexUid}/similar", path = "{indexUid}/similar",
tags = ["Indexes", "Similar documents"], tag = "Similar documents",
security(("Bearer" = ["search", "*"])), security(("Bearer" = ["search", "*"])),
params( params(("indexUid" = String, Path, example = "movies", description = "Index Unique Identifier", nullable = false)),
("indexUid" = String, Path, example = "movies", description = "Index Unique Identifier", nullable = false),
),
request_body = SimilarQuery, request_body = SimilarQuery,
responses( responses(
(status = 200, description = "The documents are returned", body = SimilarResult, content_type = "application/json", example = json!( (status = 200, description = "The documents are returned", body = SimilarResult, content_type = "application/json", example = json!(