mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-06 12:46:31 +00:00
Add utoipa types
This commit is contained in:
@ -41,6 +41,9 @@ use crate::routes::indexes::IndexView;
|
|||||||
use crate::routes::multi_search::SearchResults;
|
use crate::routes::multi_search::SearchResults;
|
||||||
use crate::routes::network::{Network, Remote};
|
use crate::routes::network::{Network, Remote};
|
||||||
use crate::routes::swap_indexes::SwapIndexesPayload;
|
use crate::routes::swap_indexes::SwapIndexesPayload;
|
||||||
|
use crate::routes::webhooks::{
|
||||||
|
WebhookResults, WebhookSettings, WebhookWithMetadata, WebhooksSettings,
|
||||||
|
};
|
||||||
use crate::search::{
|
use crate::search::{
|
||||||
FederatedSearch, FederatedSearchResult, Federation, FederationOptions, MergeFacets,
|
FederatedSearch, FederatedSearchResult, Federation, FederationOptions, MergeFacets,
|
||||||
SearchQueryWithIndex, SearchResultWithIndex, SimilarQuery, SimilarResult,
|
SearchQueryWithIndex, SearchResultWithIndex, SimilarQuery, SimilarResult,
|
||||||
@ -101,7 +104,7 @@ mod webhooks;
|
|||||||
url = "/",
|
url = "/",
|
||||||
description = "Local server",
|
description = "Local server",
|
||||||
)),
|
)),
|
||||||
components(schemas(PaginationView<KeyView>, PaginationView<IndexView>, IndexView, DocumentDeletionByFilter, AllBatches, BatchStats, ProgressStepView, ProgressView, BatchView, RuntimeTogglableFeatures, SwapIndexesPayload, DocumentEditionByFunction, MergeFacets, FederationOptions, SearchQueryWithIndex, Federation, FederatedSearch, FederatedSearchResult, SearchResults, SearchResultWithIndex, SimilarQuery, SimilarResult, PaginationView<serde_json::Value>, BrowseQuery, UpdateIndexRequest, IndexUid, IndexCreateRequest, 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, Network, Remote, FilterableAttributesRule, FilterableAttributesPatterns, AttributePatterns, FilterableAttributesFeatures, FilterFeatures, Export))
|
components(schemas(PaginationView<KeyView>, PaginationView<IndexView>, IndexView, DocumentDeletionByFilter, AllBatches, BatchStats, ProgressStepView, ProgressView, BatchView, RuntimeTogglableFeatures, SwapIndexesPayload, DocumentEditionByFunction, MergeFacets, FederationOptions, SearchQueryWithIndex, Federation, FederatedSearch, FederatedSearchResult, SearchResults, SearchResultWithIndex, SimilarQuery, SimilarResult, PaginationView<serde_json::Value>, BrowseQuery, UpdateIndexRequest, IndexUid, IndexCreateRequest, 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, Network, Remote, FilterableAttributesRule, FilterableAttributesPatterns, AttributePatterns, FilterableAttributesFeatures, FilterFeatures, Export, WebhookSettings, WebhooksSettings, WebhookResults, WebhookWithMetadata))
|
||||||
)]
|
)]
|
||||||
pub struct MeilisearchApi;
|
pub struct MeilisearchApi;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
|||||||
#[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)]
|
#[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[schema(rename_all = "camelCase")]
|
#[schema(rename_all = "camelCase")]
|
||||||
struct WebhookSettings {
|
pub(super) struct WebhookSettings {
|
||||||
#[schema(value_type = Option<String>)]
|
#[schema(value_type = Option<String>)]
|
||||||
#[deserr(default, error = DeserrJsonError<InvalidWebhooksUrl>)]
|
#[deserr(default, error = DeserrJsonError<InvalidWebhooksUrl>)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
@ -66,7 +66,7 @@ struct WebhookSettings {
|
|||||||
#[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)]
|
#[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[schema(rename_all = "camelCase")]
|
#[schema(rename_all = "camelCase")]
|
||||||
struct WebhooksSettings {
|
pub(super) struct WebhooksSettings {
|
||||||
#[schema(value_type = Option<BTreeMap<String, WebhookSettings>>)]
|
#[schema(value_type = Option<BTreeMap<String, WebhookSettings>>)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
webhooks: Setting<BTreeMap<Uuid, Setting<WebhookSettings>>>,
|
webhooks: Setting<BTreeMap<Uuid, Setting<WebhookSettings>>>,
|
||||||
@ -75,7 +75,7 @@ struct WebhooksSettings {
|
|||||||
#[derive(Debug, Serialize, ToSchema)]
|
#[derive(Debug, Serialize, ToSchema)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[schema(rename_all = "camelCase")]
|
#[schema(rename_all = "camelCase")]
|
||||||
struct WebhookWithMetadata {
|
pub(super) struct WebhookWithMetadata {
|
||||||
uuid: Uuid,
|
uuid: Uuid,
|
||||||
is_editable: bool,
|
is_editable: bool,
|
||||||
#[schema(value_type = WebhookSettings)]
|
#[schema(value_type = WebhookSettings)]
|
||||||
@ -83,9 +83,9 @@ struct WebhookWithMetadata {
|
|||||||
webhook: Webhook,
|
webhook: Webhook,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize, ToSchema)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
struct WebhookResults {
|
pub(super) struct WebhookResults {
|
||||||
results: Vec<WebhookWithMetadata>,
|
results: Vec<WebhookWithMetadata>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ struct WebhookResults {
|
|||||||
tag = "Webhooks",
|
tag = "Webhooks",
|
||||||
security(("Bearer" = ["webhooks.get", "*.get", "*"])),
|
security(("Bearer" = ["webhooks.get", "*.get", "*"])),
|
||||||
responses(
|
responses(
|
||||||
(status = OK, description = "Webhooks are returned", body = WebhooksSettings, content_type = "application/json", example = json!({
|
(status = OK, description = "Webhooks are returned", body = WebhookResults, content_type = "application/json", example = json!({
|
||||||
"results": [
|
"results": [
|
||||||
{
|
{
|
||||||
"uuid": "550e8400-e29b-41d4-a716-446655440000",
|
"uuid": "550e8400-e29b-41d4-a716-446655440000",
|
||||||
|
Reference in New Issue
Block a user