aide/openapi/
components.rs

1use crate::openapi::*;
2use indexmap::IndexMap;
3use serde::{Deserialize, Serialize};
4
5/// Holds a set of reusable objects for different aspects of the OAS.
6/// All objects defined within the components object will have no effect
7/// on the API unless they are explicitly referenced from properties
8/// outside the components object.
9#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
10#[serde(rename_all = "camelCase")]
11#[derive(schemars::JsonSchema)]
12pub struct Components {
13    /// An object to hold reusable Security Scheme Objects.
14    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
15    pub security_schemes: IndexMap<String, ReferenceOr<SecurityScheme>>,
16    /// An object to hold reusable Response Objects.
17    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
18    pub responses: IndexMap<String, ReferenceOr<Response>>,
19    /// An object to hold reusable Parameter Objects.
20    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
21    pub parameters: IndexMap<String, ReferenceOr<Parameter>>,
22    /// An object to hold reusable Example Objects.
23    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
24    pub examples: IndexMap<String, ReferenceOr<Example>>,
25    /// An object to hold reusable Request Body Objects.
26    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
27    pub request_bodies: IndexMap<String, ReferenceOr<RequestBody>>,
28    /// An object to hold reusable Header Objects.
29    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
30    pub headers: IndexMap<String, ReferenceOr<Header>>,
31    /// An object to hold reusable Schema Objects.
32    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
33    pub schemas: IndexMap<String, SchemaObject>,
34    /// An object to hold reusable Link Objects.
35    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
36    pub links: IndexMap<String, ReferenceOr<Link>>,
37    /// An object to hold reusable Callback Objects.
38    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
39    pub callbacks: IndexMap<String, ReferenceOr<Callback>>,
40    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
41    /// An object to hold reusable Path Item Objects.
42    pub path_items: IndexMap<String, ReferenceOr<PathItem>>,
43    /// Inline extensions to this object.
44    #[serde(flatten, deserialize_with = "crate::util::deserialize_extensions")]
45    pub extensions: IndexMap<String, serde_json::Value>,
46}