Skip to content

[docs] update extractor docs: fix a typo, increase verbosity #1388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions dropshot/src/extractor/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ use std::fmt::Debug;
// type. Only JSON is currently supported.

/// `TypedBody<BodyType>` is an extractor used to deserialize an instance of
/// `BodyType` from an HTTP request body. `BodyType` is any structure of yours
/// that implements `serde::Deserialize`. See this module's documentation for
/// more information.
/// `BodyType` from an HTTP request body. `BodyType` may be any struct of yours
/// that implements [serde::Deserialize] and [schemars::JsonSchema], where
/// primitives and enums have to be wrapped in an outer struct and enums need
/// to be flattened using the `#[serde(flatten)]` attribute. See this module's
/// documentation formore information.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// documentation formore information.
/// documentation for more information.

#[derive(Debug)]
pub struct TypedBody<BodyType: JsonSchema + DeserializeOwned + Send + Sync> {
inner: BodyType,
Expand Down
13 changes: 8 additions & 5 deletions dropshot/src/extractor/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ use crate::{
use super::{metadata::get_metadata, ExtractorMetadata, SharedExtractor};

/// `Header<HeaderType>` is an extractor used to deserialize an instance of
/// `HeaderType` from an HTTP request's header values. `PathType` may be any
/// structure that implements [serde::Deserialize] and [schemars::JsonSchema].
/// While headers are accessible through [RequestInfo::headers], using this
/// extractor in an entrypoint causes header inputs to be documented in
/// OpenAPI output. See the crate documentation for more information.
/// `HeaderType` from an HTTP request's header values. `HeaderType` may be any
/// struct of yours that implements [serde::Deserialize] and
/// [schemars::JsonSchema], where primitives and enums have to be wrapped in
/// an outer struct and enums need to be flattened using the
/// `#[serde(flatten)]` attribute. While headers are accessible through
/// [RequestInfo::headers], using this extractor in an entrypoint causes header
/// inputs to be documented in OpenAPI output.
Comment on lines +24 to +26
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// `#[serde(flatten)]` attribute. While headers are accessible through
/// [RequestInfo::headers], using this extractor in an entrypoint causes header
/// inputs to be documented in OpenAPI output.
/// `#[serde(flatten)]` attribute. While headers are always accessible through
/// [RequestInfo::headers] even without this extractor, using this extractor causes header
/// inputs to be documented in OpenAPI output.

/// See the crate documentation for more information.
pub struct Header<HeaderType: DeserializeOwned + JsonSchema + Send + Sync> {
inner: HeaderType,
}
Expand Down
10 changes: 6 additions & 4 deletions dropshot/src/extractor/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ use schemars::JsonSchema;
use serde::de::DeserializeOwned;
use std::fmt::Debug;

/// `Path<PathType>` is an extractor used to deserialize an instance of
/// `PathType` from an HTTP request's path parameters. `PathType` is any
/// structure of yours that implements [serde::Deserialize] and
/// [schemars::JsonSchema]. See the crate documentation for more information.
/// `Path<PathType>` is an extractor used to deserialize an instance of
/// `PathType` from an HTTP request's path parameters. `PathType` may be any
/// struct of yours that implements [serde::Deserialize] and
/// [schemars::JsonSchema], where primitives and enums have to be wrapped in an
/// outer struct and enums need to be flattened using the `#[serde(flatten)]`
/// attribute. See this module's documentation formore information.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// attribute. See this module's documentation formore information.
/// attribute. See this module's documentation for more information.

#[derive(Debug)]
pub struct Path<PathType: JsonSchema + Send + Sync> {
inner: PathType,
Expand Down
9 changes: 6 additions & 3 deletions dropshot/src/extractor/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ use serde::de::DeserializeOwned;
use std::fmt::Debug;

/// `Query<QueryType>` is an extractor used to deserialize an instance of
/// `QueryType` from an HTTP request's query string. `QueryType` is any
/// structure of yours that implements [serde::Deserialize] and
/// [schemars::JsonSchema]. See the crate documentation for more information.
/// `QueryType` from an HTTP request's query string. `QueryType` may be any
/// struct of yours that implements [serde::Deserialize] and
/// [schemars::JsonSchema], where primitives and enums have to be wrapped in
/// an outer struct and enums need to be flattened using the
/// `#[serde(flatten)]` attribute. See this module's documentation for more
/// information.
#[derive(Debug)]
pub struct Query<QueryType: DeserializeOwned + JsonSchema + Send + Sync> {
inner: QueryType,
Expand Down