anicca/openapi/
document.rs

1use super::*;
2use serde::{Deserialize, Serialize};
3use std::collections::BTreeMap;
4
5#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
6pub struct OpenAPI {
7    /// REQUIRED. This string MUST be the semantic version number of the
8    /// OpenAPI Specification version that the OpenAPI document uses.
9    /// The openapi field SHOULD be used by tooling specifications and
10    /// clients to interpret the OpenAPI document. This is not related to
11    /// the API info.version string.
12    pub openapi: String,
13
14    pub info: Info,
15    #[serde(default)]
16    #[serde(skip_serializing_if = "Vec::is_empty")]
17    pub servers: Vec<Server>,
18    pub paths: Paths,
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub components: Option<Components>,
21    #[serde(default)]
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub security: Option<Vec<SecurityRequirement>>,
24    #[serde(default)]
25    #[serde(skip_serializing_if = "Vec::is_empty")]
26    pub tags: Vec<Tag>,
27    #[serde(rename = "externalDocs")]
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub external_docs: Option<ExternalDocumentation>,
30    #[serde(flatten)]
31    pub extensions: BTreeMap<String, serde_json::Value>,
32}
33
34/// Adds metadata to a single tag that is used by the
35/// Operation Object. It is not mandatory to have a
36/// Tag Object per tag defined in the Operation Object instances.
37#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
38pub struct Tag {
39    /// REQUIRED. The name of the tag.
40    pub name: String,
41    /// A short description for the tag.
42    /// CommonMark syntax MAY be used for rich text representation.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub description: Option<String>,
45    /// Additional external documentation for this tag.
46    #[serde(rename = "externalDocs", skip_serializing_if = "Option::is_none")]
47    pub external_docs: Option<ExternalDocumentation>,
48    /// Inline extensions to this object.
49    #[serde(flatten)]
50    pub extensions: BTreeMap<String, serde_json::Value>,
51}