modality_mutator_server/
lib.rs

1#![deny(warnings, clippy::all)]
2use std::collections::BTreeMap;
3#[cfg(feature = "server")]
4pub mod server;
5
6use modality_mutator_protocol::attrs::{AttrKey, AttrVal};
7use uuid::Uuid;
8
9/// Mutator representation for HTTP
10#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
11#[cfg_attr(feature = "server", derive(utoipa::ToSchema))]
12pub struct Mutator {
13    /// HTTP-server local identifier for the mutator.
14    #[cfg_attr(feature = "server", schema(example = "abc123"))]
15    pub mutator_correlation_id: String,
16
17    /// Mutator's attributes
18    #[cfg_attr(feature = "server", schema())]
19    pub attributes: BTreeMap<AttrKey, AttrVal>,
20}
21
22/// Mutation request representation for HTTP
23#[derive(serde::Serialize, serde::Deserialize, Clone)]
24#[cfg_attr(feature = "server", derive(utoipa::ToSchema))]
25pub struct Mutation {
26    #[cfg_attr(feature = "server", schema())]
27    pub mutation: Uuid,
28
29    /// Mutation parameters
30    #[cfg_attr(feature = "server", schema())]
31    pub params: BTreeMap<AttrKey, AttrVal>,
32}
33
34pub type GetAllMutatorsResponse = Vec<Mutator>;
35
36pub const MUTATOR_API_KEY_HEADER: &str = "mutator_apikey";
37pub const MUTATOR_API_CONTROL_HEADER: &str = "x-auxon-mutation-control";