openapiv3/
request_body.rs

1use crate::*;
2use indexmap::IndexMap;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
6pub struct RequestBody {
7    /// A brief description of the request body.
8    /// This could contain examples of use.
9    /// CommonMark syntax MAY be used for rich text representation.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub description: Option<String>,
12    /// REQUIRED. The content of the request body.
13    /// The key is a media type or media type range and
14    /// the value describes it. For requests that match
15    /// multiple keys, only the most specific key is applicable.
16    ///  e.g. text/plain overrides text/*
17    #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
18    pub content: IndexMap<String, MediaType>,
19    /// Determines if the request body is required in the
20    /// request. Defaults to false.
21    #[serde(default, skip_serializing_if = "is_false")]
22    pub required: bool,
23    /// Inline extensions to this object.
24    #[serde(flatten, deserialize_with = "crate::util::deserialize_extensions")]
25    pub extensions: IndexMap<String, serde_json::Value>,
26}