1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::collections::BTreeMap;

use apistos_models::paths::Response;
use apistos_models::reference_or::ReferenceOr;
use apistos_models::ApistosSchema;

pub trait ApiErrorComponent {
  fn schemas_by_status_code(
    oas_version: apistos_models::OpenApiVersion,
  ) -> BTreeMap<String, (String, ReferenceOr<ApistosSchema>)>;
  fn error_responses(oas_version: apistos_models::OpenApiVersion) -> Vec<(String, Response)>;
}

#[cfg(feature = "actix")]
impl ApiErrorComponent for actix_web::error::Error {
  fn schemas_by_status_code(
    _: apistos_models::OpenApiVersion,
  ) -> BTreeMap<String, (String, ReferenceOr<ApistosSchema>)> {
    BTreeMap::default()
  }

  fn error_responses(_: apistos_models::OpenApiVersion) -> Vec<(String, Response)> {
    vec![]
  }
}