Skip to content

Commit 9af2dc9

Browse files
committed
docs: document request body fields
1 parent 04ebbe2 commit 9af2dc9

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

crates/oas3/src/spec/path_item.rs

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ pub struct PathItem {
9494
}
9595

9696
impl PathItem {
97+
/// Returns iterator over this path's provided operations, keyed by method.
9798
pub fn methods(&self) -> impl IntoIterator<Item = (Method, &Operation)> {
9899
let mut methods = vec![];
99100

crates/oas3/src/spec/request_body.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,28 @@ use super::{FromRef, MediaType, Ref, RefError, RefType, Spec};
77
/// Describes a single request body.
88
///
99
/// See <https://github.com/OAI/OpenAPI-Specification/blob/HEAD/versions/3.1.0.md#request-body-object>.
10-
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
10+
#[derive(Debug, Clone, Default, PartialEq, Deserialize, Serialize)]
1111
pub struct RequestBody {
12-
/// A brief description of the request body. This could contain examples of use.
12+
/// A brief description of the request body.
13+
///
14+
/// This could contain examples of use.
1315
///
1416
/// [CommonMark syntax](https://spec.commonmark.org) MAY be used for rich text representation.
1517
#[serde(skip_serializing_if = "Option::is_none")]
1618
pub description: Option<String>,
1719

18-
/// The content of the request body. The key is a media type or
19-
/// [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the
20-
/// value describes it. For requests that match multiple keys, only the most specific key
21-
/// is applicable. e.g. text/plain overrides text/*
20+
/// The content of the request body.
21+
///
22+
/// The key is a media type or [media type range] and the value describes it. For requests that
23+
/// match multiple keys, only the most specific key is applicable. E.g., `text/plain` overrides
24+
/// `text/*`.
25+
///
26+
/// [media type range]: https://tools.ietf.org/html/rfc7231#appendix-D
2227
pub content: BTreeMap<String, MediaType>,
2328

29+
/// Determines if the request body is required in the request.
30+
///
31+
/// Defaults to false.
2432
#[serde(skip_serializing_if = "Option::is_none")]
2533
pub required: Option<bool>,
2634
}

0 commit comments

Comments
 (0)