openapiv3/
request_body.rs

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