openapiv3/
components.rs

1use crate::*;
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")]
11pub struct Components {
12    /// An object to hold reusable Schema Objects.
13    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
14    pub schemas: IndexMap<String, ReferenceOr<Schema>>,
15    /// An object to hold reusable Response Objects.
16    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
17    pub responses: IndexMap<String, ReferenceOr<Response>>,
18    /// An object to hold reusable Parameter Objects.
19    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
20    pub parameters: IndexMap<String, ReferenceOr<Parameter>>,
21    /// An object to hold reusable Example Objects.
22    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
23    pub examples: IndexMap<String, ReferenceOr<Example>>,
24    /// An object to hold reusable Request Body Objects.
25    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
26    pub request_bodies: IndexMap<String, ReferenceOr<RequestBody>>,
27    /// An object to hold reusable Header Objects.
28    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
29    pub headers: IndexMap<String, ReferenceOr<Header>>,
30    /// An object to hold reusable Security Scheme Objects.
31    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
32    pub security_schemes: IndexMap<String, ReferenceOr<SecurityScheme>>,
33    /// An object to hold reusable Link Objects.
34    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
35    pub links: IndexMap<String, ReferenceOr<Link>>,
36    /// An object to hold reusable Callback Objects.
37    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
38    pub callbacks: IndexMap<String, ReferenceOr<Callback>>,
39    /// Inline extensions to this object.
40    #[serde(flatten, deserialize_with = "crate::util::deserialize_extensions")]
41    pub extensions: IndexMap<String, serde_json::Value>,
42}