cat_gateway/service/common/objects/config/
mod.rs

1//! Config object definitions.
2
3mod environment;
4pub(crate) mod frontend_config;
5mod version;
6
7use poem_openapi::{types::Example, Object};
8
9use crate::service::common;
10
11/// Configuration Data Validation Error.
12#[derive(Object)]
13#[oai(example = true)]
14pub(crate) struct ConfigUnprocessableContent {
15    /// Error messages.
16    error: common::types::generic::error_msg::ErrorMessage,
17    /// Optional schema validation errors.
18    #[oai(default, skip_serializing_if_is_empty)]
19    schema_validation_errors: common::types::generic::error_list::ErrorList,
20}
21
22impl ConfigUnprocessableContent {
23    /// Create a new instance of `ConfigBadRequest`.
24    pub(crate) fn new(
25        error: String,
26        schema_validation_errors: Option<common::types::generic::error_list::ErrorList>,
27    ) -> Self {
28        Self {
29            error: error.into(),
30            schema_validation_errors: schema_validation_errors.unwrap_or_default(),
31        }
32    }
33}
34
35impl Example for ConfigUnprocessableContent {
36    fn example() -> Self {
37        Self {
38            error: "Invalid Data".to_string().into(),
39            schema_validation_errors: Example::example(),
40        }
41    }
42}