set all enum to be snake_case when serializing

This commit is contained in:
Kat Lim Ruiz
2025-04-01 17:13:04 -05:00
parent 17bf8aa092
commit 83f6c2f265
3 changed files with 6 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ use serde::Serialize;
/// Defines whether a term in a query must be present,
/// should be present or must not be present.
#[derive(Debug, Clone, Hash, Copy, Eq, PartialEq, Serialize)]
#[serde(rename_all_fields = "snake_case")]
pub enum Occur {
/// For a given document to be considered for scoring,
/// at least one of the queries with the Should or the Must

View File

@@ -797,6 +797,7 @@ fn operand_occur_leaf_infallible(
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[serde(rename_all_fields = "snake_case")]
enum BinaryOperand {
Or,
And,

View File

@@ -6,6 +6,7 @@ use serde::Serialize;
use crate::Occur;
#[derive(PartialEq, Clone, Serialize)]
#[serde(rename_all_fields = "snake_case")]
pub enum UserInputLeaf {
Literal(UserInputLiteral),
All,
@@ -110,6 +111,7 @@ impl Debug for UserInputLeaf {
}
#[derive(Copy, Clone, Eq, PartialEq, Debug, Serialize)]
#[serde(rename_all_fields = "snake_case")]
pub enum Delimiter {
SingleQuotes,
DoubleQuotes,
@@ -155,6 +157,7 @@ impl fmt::Debug for UserInputLiteral {
}
#[derive(PartialEq, Debug, Clone, Serialize)]
#[serde(rename_all_fields = "snake_case")]
pub enum UserInputBound {
Inclusive(String),
Exclusive(String),
@@ -190,6 +193,7 @@ impl UserInputBound {
}
#[derive(PartialEq, Clone, Serialize)]
#[serde(rename_all_fields = "snake_case")]
pub enum UserInputAst {
Clause(Vec<(Option<Occur>, UserInputAst)>),
Leaf(Box<UserInputLeaf>),