Polish make_setting_routes!

This commit is contained in:
ManyTheFish 2024-11-28 11:44:09 +01:00
parent 68c4717e21
commit 9f36ffcbdb

View File

@ -18,7 +18,7 @@ use crate::routes::{get_task_id, is_dry_run, SummarizedTaskView};
use crate::Opt; use crate::Opt;
macro_rules! make_setting_routes { macro_rules! make_setting_routes {
($({$route:literal, $update_verb:ident, $type:ty, $err_ty:ty, $attr:ident, $camelcase_attr:literal, $analytics:ident}),*) => { ($({route: $route:literal, update_verb: $update_verb:ident, value_type: $type:ty, err_type: $err_ty:ty, attr: $attr:ident, camelcase_attr: $camelcase_attr:literal, analytics: $analytics:ident},)*) => {
$( $(
make_setting_route!($route, $update_verb, $type, $err_ty, $attr, $camelcase_attr, $analytics); make_setting_route!($route, $update_verb, $type, $err_ty, $attr, $camelcase_attr, $analytics);
)* )*
@ -175,225 +175,225 @@ macro_rules! make_setting_route {
make_setting_routes!( make_setting_routes!(
{ {
"/filterable-attributes", route: "/filterable-attributes",
put, update_verb: put,
std::collections::BTreeSet<String>, value_type: std::collections::BTreeSet<String>,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsFilterableAttributes, meilisearch_types::error::deserr_codes::InvalidSettingsFilterableAttributes,
>, >,
filterable_attributes, attr: filterable_attributes,
"filterableAttributes", camelcase_attr: "filterableAttributes",
FilterableAttributesAnalytics analytics: FilterableAttributesAnalytics
}, },
{ {
"/sortable-attributes", route: "/sortable-attributes",
put, update_verb: put,
std::collections::BTreeSet<String>, value_type: std::collections::BTreeSet<String>,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsSortableAttributes, meilisearch_types::error::deserr_codes::InvalidSettingsSortableAttributes,
>, >,
sortable_attributes, attr: sortable_attributes,
"sortableAttributes", camelcase_attr: "sortableAttributes",
SortableAttributesAnalytics analytics: SortableAttributesAnalytics
}, },
{ {
"/displayed-attributes", route: "/displayed-attributes",
put, update_verb: put,
Vec<String>, value_type: Vec<String>,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsDisplayedAttributes, meilisearch_types::error::deserr_codes::InvalidSettingsDisplayedAttributes,
>, >,
displayed_attributes, attr: displayed_attributes,
"displayedAttributes", camelcase_attr: "displayedAttributes",
DisplayedAttributesAnalytics analytics: DisplayedAttributesAnalytics
}, },
{ {
"/typo-tolerance", route: "/typo-tolerance",
patch, update_verb: patch,
meilisearch_types::settings::TypoSettings, value_type: meilisearch_types::settings::TypoSettings,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsTypoTolerance, meilisearch_types::error::deserr_codes::InvalidSettingsTypoTolerance,
>, >,
typo_tolerance, attr: typo_tolerance,
"typoTolerance", camelcase_attr: "typoTolerance",
TypoToleranceAnalytics analytics: TypoToleranceAnalytics
}, },
{ {
"/searchable-attributes", route: "/searchable-attributes",
put, update_verb: put,
Vec<String>, value_type: Vec<String>,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsSearchableAttributes, meilisearch_types::error::deserr_codes::InvalidSettingsSearchableAttributes,
>, >,
searchable_attributes, attr: searchable_attributes,
"searchableAttributes", camelcase_attr: "searchableAttributes",
SearchableAttributesAnalytics analytics: SearchableAttributesAnalytics
}, },
{ {
"/stop-words", route: "/stop-words",
put, update_verb: put,
std::collections::BTreeSet<String>, value_type: std::collections::BTreeSet<String>,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsStopWords, meilisearch_types::error::deserr_codes::InvalidSettingsStopWords,
>, >,
stop_words, attr: stop_words,
"stopWords", camelcase_attr: "stopWords",
StopWordsAnalytics analytics: StopWordsAnalytics
}, },
{ {
"/non-separator-tokens", route: "/non-separator-tokens",
put, update_verb: put,
std::collections::BTreeSet<String>, value_type: std::collections::BTreeSet<String>,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsNonSeparatorTokens, meilisearch_types::error::deserr_codes::InvalidSettingsNonSeparatorTokens,
>, >,
non_separator_tokens, attr: non_separator_tokens,
"nonSeparatorTokens", camelcase_attr: "nonSeparatorTokens",
NonSeparatorTokensAnalytics analytics: NonSeparatorTokensAnalytics
}, },
{ {
"/separator-tokens", route: "/separator-tokens",
put, update_verb: put,
std::collections::BTreeSet<String>, value_type: std::collections::BTreeSet<String>,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsSeparatorTokens, meilisearch_types::error::deserr_codes::InvalidSettingsSeparatorTokens,
>, >,
separator_tokens, attr: separator_tokens,
"separatorTokens", camelcase_attr: "separatorTokens",
SeparatorTokensAnalytics analytics: SeparatorTokensAnalytics
}, },
{ {
"/dictionary", route: "/dictionary",
put, update_verb: put,
std::collections::BTreeSet<String>, value_type: std::collections::BTreeSet<String>,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsDictionary, meilisearch_types::error::deserr_codes::InvalidSettingsDictionary,
>, >,
dictionary, attr: dictionary,
"dictionary", camelcase_attr: "dictionary",
DictionaryAnalytics analytics: DictionaryAnalytics
}, },
{ {
"/synonyms", route: "/synonyms",
put, update_verb: put,
std::collections::BTreeMap<String, Vec<String>>, value_type: std::collections::BTreeMap<String, Vec<String>>,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsSynonyms, meilisearch_types::error::deserr_codes::InvalidSettingsSynonyms,
>, >,
synonyms, attr: synonyms,
"synonyms", camelcase_attr: "synonyms",
SynonymsAnalytics analytics: SynonymsAnalytics
}, },
{ {
"/distinct-attribute", route: "/distinct-attribute",
put, update_verb: put,
String, value_type: String,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsDistinctAttribute, meilisearch_types::error::deserr_codes::InvalidSettingsDistinctAttribute,
>, >,
distinct_attribute, attr: distinct_attribute,
"distinctAttribute", camelcase_attr: "distinctAttribute",
DistinctAttributeAnalytics analytics: DistinctAttributeAnalytics
}, },
{ {
"/proximity-precision", route: "/proximity-precision",
put, update_verb: put,
meilisearch_types::settings::ProximityPrecisionView, value_type: meilisearch_types::settings::ProximityPrecisionView,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsProximityPrecision, meilisearch_types::error::deserr_codes::InvalidSettingsProximityPrecision,
>, >,
proximity_precision, attr: proximity_precision,
"proximityPrecision", camelcase_attr: "proximityPrecision",
ProximityPrecisionAnalytics analytics: ProximityPrecisionAnalytics
}, },
{ {
"/localized-attributes", route: "/localized-attributes",
put, update_verb: put,
Vec<meilisearch_types::locales::LocalizedAttributesRuleView>, value_type: Vec<meilisearch_types::locales::LocalizedAttributesRuleView>,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsLocalizedAttributes, meilisearch_types::error::deserr_codes::InvalidSettingsLocalizedAttributes,
>, >,
localized_attributes, attr: localized_attributes,
"localizedAttributes", camelcase_attr: "localizedAttributes",
LocalesAnalytics analytics: LocalesAnalytics
}, },
{ {
"/ranking-rules", route: "/ranking-rules",
put, update_verb: put,
Vec<meilisearch_types::settings::RankingRuleView>, value_type: Vec<meilisearch_types::settings::RankingRuleView>,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsRankingRules, meilisearch_types::error::deserr_codes::InvalidSettingsRankingRules,
>, >,
ranking_rules, attr: ranking_rules,
"rankingRules", camelcase_attr: "rankingRules",
RankingRulesAnalytics analytics: RankingRulesAnalytics
}, },
{ {
"/faceting", route: "/faceting",
patch, update_verb: patch,
meilisearch_types::settings::FacetingSettings, value_type: meilisearch_types::settings::FacetingSettings,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsFaceting, meilisearch_types::error::deserr_codes::InvalidSettingsFaceting,
>, >,
faceting, attr: faceting,
"faceting", camelcase_attr: "faceting",
FacetingAnalytics analytics: FacetingAnalytics
}, },
{ {
"/pagination", route: "/pagination",
patch, update_verb: patch,
meilisearch_types::settings::PaginationSettings, value_type: meilisearch_types::settings::PaginationSettings,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsPagination, meilisearch_types::error::deserr_codes::InvalidSettingsPagination,
>, >,
pagination, attr: pagination,
"pagination", camelcase_attr: "pagination",
PaginationAnalytics analytics: PaginationAnalytics
}, },
{ {
"/embedders", route: "/embedders",
patch, update_verb: patch,
std::collections::BTreeMap<String, Setting<meilisearch_types::milli::vector::settings::EmbeddingSettings>>, value_type: std::collections::BTreeMap<String, Setting<meilisearch_types::milli::vector::settings::EmbeddingSettings>>,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsEmbedders, meilisearch_types::error::deserr_codes::InvalidSettingsEmbedders,
>, >,
embedders, attr: embedders,
"embedders", camelcase_attr: "embedders",
EmbeddersAnalytics analytics: EmbeddersAnalytics
}, },
{ {
"/search-cutoff-ms", route: "/search-cutoff-ms",
put, update_verb: put,
u64, value_type: u64,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsSearchCutoffMs, meilisearch_types::error::deserr_codes::InvalidSettingsSearchCutoffMs,
>, >,
search_cutoff_ms, attr: search_cutoff_ms,
"searchCutoffMs", camelcase_attr: "searchCutoffMs",
SearchCutoffMsAnalytics analytics: SearchCutoffMsAnalytics
}, },
{ {
"/facet-search", route: "/facet-search",
put, update_verb: put,
bool, value_type: bool,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsFacetSearch, meilisearch_types::error::deserr_codes::InvalidSettingsFacetSearch,
>, >,
facet_search, attr: facet_search,
"facetSearch", camelcase_attr: "facetSearch",
FacetSearchAnalytics analytics: FacetSearchAnalytics
}, },
{ {
"/prefix-search", route: "/prefix-search",
put, update_verb: put,
meilisearch_types::settings::PrefixSearchSettings, value_type: meilisearch_types::settings::PrefixSearchSettings,
meilisearch_types::deserr::DeserrJsonError< err_type: meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsPrefixSearch, meilisearch_types::error::deserr_codes::InvalidSettingsPrefixSearch,
>, >,
prefix_search, attr: prefix_search,
"prefixSearch", camelcase_attr: "prefixSearch",
PrefixSearchAnalytics analytics: PrefixSearchAnalytics
} },
); );
pub async fn update_all( pub async fn update_all(