Skip to content

Commit ddb07a7

Browse files
committed
Add docs for rocket_db_pools feature flag
Cleanup and docs after merging of #104
1 parent 282d22c commit ddb07a7

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Rocket-Okapi:
114114
- `mtls`: Enable [mutual TSL for Rocket](https://rocket.rs/v0.5-rc/guide/configuration/#mutual-tls).
115115
(when same Rocket feature flag is used.)
116116
- `rocket_dyn_templates`: Enable compatibility with [`rocket_dyn_templates`](https://crates.io/crates/rocket_dyn_templates).
117+
- `rocket_db_pools`: Enable compatibility with [`rocket_db_pools`](https://crates.io/crates/rocket_db_pools).
117118

118119
Note that not all feature flags from [`Schemars`][Schemars] are re-exported or enabled.
119120
So if you have objects for which the `JsonSchema` trait is not implemented,

rocket-okapi/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ because of incompatibility.
4343
- `rocket::http::uri::Host`
4444
- `Certificate` (when `mtls` feature is enabled)
4545
- `FlashMessage`
46+
- `rocket_db_pools::Connection<D>` (when `rocket_db_pools` feature is enabled) (#104)
4647
- New feature flag `rocket_dyn_templates` for enable compatibility with
4748
[`rocket_dyn_templates`](https://crates.io/crates/rocket_dyn_templates).
49+
- New feature flag `rocket_db_pools` for enable compatibility with
50+
[`rocket_db_pools`](https://crates.io/crates/rocket_db_pools).
4851
- New example for Rocket's Dynamic Templates.
4952

5053
### Changed

rocket-okapi/src/request/from_request_impls.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,6 @@ impl<'r, T: Send + Sync + 'static> OpenApiFromRequest<'r> for &'r rocket::State<
162162
}
163163
}
164164

165-
#[cfg(feature = "rocket_db_pools")]
166-
impl<'r, T: rocket_db_pools::Database> OpenApiFromRequest<'r> for rocket_db_pools::Connection<T> {
167-
fn from_request_input(_gen: &mut OpenApiGenerator, _name: String, _required: bool) -> Result {
168-
Ok(RequestHeaderInput::None)
169-
}
170-
}
171-
172165
impl<'r, T: OpenApiFromRequest<'r>> OpenApiFromRequest<'r> for Option<T> {
173166
fn from_request_input(gen: &mut OpenApiGenerator, name: String, _required: bool) -> Result {
174167
T::from_request_input(gen, name, false)
@@ -180,3 +173,13 @@ impl<'r, T: OpenApiFromRequest<'r>> OpenApiFromRequest<'r> for StdResult<T, T::E
180173
T::from_request_input(gen, name, required)
181174
}
182175
}
176+
177+
// ## Implementations for other crates
178+
// https://docs.rs/rocket_db_pools/0.1.0-rc.2/rocket_db_pools/struct.Connection.html#impl-FromRequest%3C%27r%3E
179+
180+
#[cfg(feature = "rocket_db_pools")]
181+
impl<'r, D: rocket_db_pools::Database> OpenApiFromRequest<'r> for rocket_db_pools::Connection<D> {
182+
fn from_request_input(_gen: &mut OpenApiGenerator, _name: String, _required: bool) -> Result {
183+
Ok(RequestHeaderInput::None)
184+
}
185+
}

0 commit comments

Comments
 (0)