Skip to content
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

Update Rocket v0.5 #825

Merged
merged 3 commits into from
Jan 1, 2024
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Refer to the existing [examples](./examples) for building the "todo" app in the
- **[axum](https://github.com/tokio-rs/axum)**
- **[warp](https://github.com/seanmonstar/warp)**
- **[tide](https://github.com/http-rs/tide)**
- **[rocket](https://github.com/SergioBenitez/Rocket)** (`0.4` and `0.5.0-rc3`)
- **[rocket](https://github.com/SergioBenitez/Rocket)** (`0.4` and `0.5`)

All examples include a [Swagger-UI](https://github.com/swagger-api/swagger-ui) unless stated otherwise.

Expand Down
2 changes: 1 addition & 1 deletion examples/rocket-todo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors = ["Elli Example <example@example.com>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rocket = { version = "0.5.0-rc.3", features = ["json"] }
rocket = { version = "0.5", features = ["json"] }
utoipa = { path = "../../utoipa", features = ["rocket_extras"] }
utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = ["rocket"] }
utoipa-redoc = { path = "../../utoipa-redoc", features = ["rocket"] }
Expand Down
11 changes: 4 additions & 7 deletions examples/rocket-todo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ fn rocket() -> Rocket<Build> {
)
// There is no need to create RapiDoc::with_openapi because the OpenApi is served
// via SwaggerUi instead we only make rapidoc to point to the existing doc.
.mount(
"/",
RapiDoc::new("/api-docs/openapi.json").path("/rapidoc")
)
.mount("/", RapiDoc::new("/api-docs/openapi.json").path("/rapidoc"))
// Alternative to above
// .mount(
// "/",
Expand Down Expand Up @@ -127,11 +124,11 @@ mod todo {
async fn from_request(request: &'r Request<'_>) -> request::Outcome<Self, Self::Error> {
match request.headers().get("todo_apikey").next() {
Some(key) if key == "utoipa-rocks" => Outcome::Success(RequireApiKey),
None => Outcome::Failure((
None => Outcome::Error((
Status::Unauthorized,
TodoError::Unauthorized(String::from("missing api key")),
)),
_ => Outcome::Failure((
_ => Outcome::Error((
Status::Unauthorized,
TodoError::Unauthorized(String::from("invalid api key")),
)),
Expand All @@ -153,7 +150,7 @@ mod todo {
}
_ => {
log::info!("no api key");
Outcome::Forward(())
Outcome::Forward(Status::Unauthorized)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion utoipa-gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ serde = "1"
actix-web = { version = "4", features = ["macros"], default-features = false }
axum = "0.7"
paste = "1"
rocket = { version = "0.5.0-rc.3", features = ["json"] }
rocket = { version = "0.5", features = ["json"] }
smallvec = { version = "1.10", features = ["serde"] }
rust_decimal = "1"
chrono = { version = "0.4", features = ["serde"] }
Expand Down
2 changes: 1 addition & 1 deletion utoipa-rapidoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
utoipa = { version = "4", path = "../utoipa" }
actix-web = { version = "4", optional = true, default-features = false }
rocket = { version = "0.5.0-rc.3", features = ["json"], optional = true }
rocket = { version = "0.5", features = ["json"], optional = true }
axum = { version = "0.7", optional = true }
2 changes: 1 addition & 1 deletion utoipa-rapidoc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You may find fullsize examples from utoipa's Github [repository][examples].
# Crate Features

* **actix-web** Allows serving `RapiDoc` via _**`actix-web`**_. `version >= 4`
* **rocket** Allows serving `RapiDoc` via _**`rocket`**_. `version >=0.5.0-rc.3`
* **rocket** Allows serving `RapiDoc` via _**`rocket`**_. `version >=0.5`
* **axum** Allows serving `RapiDoc` via _**`axum`**_. `version >=0.7`

# Install
Expand Down
2 changes: 1 addition & 1 deletion utoipa-redoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
utoipa = { version = "4", path = "../utoipa" }
actix-web = { version = "4", optional = true, default-features = false }
rocket = { version = "0.5.0-rc.3", features = ["json"], optional = true }
rocket = { version = "0.5", features = ["json"], optional = true }
axum = { version = "0.7", optional = true }
2 changes: 1 addition & 1 deletion utoipa-redoc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You may find fullsize examples from utoipa's Github [repository][examples].
# Crate Features

* **actix-web** Allows serving `Redoc` via _**`actix-web`**_. `version >= 4`
* **rocket** Allows serving `Redoc` via _**`rocket`**_. `version >=0.5.0-rc.3`
* **rocket** Allows serving `Redoc` via _**`rocket`**_. `version >=0.5`
* **axum** Allows serving `Redoc` via _**`axum`**_. `version >=0.7`

# Install
Expand Down
2 changes: 1 addition & 1 deletion utoipa-swagger-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ debug-embed = ["rust-embed/debug-embed"]
rust-embed = { version = "8", features = ["interpolate-folder-path"] }
mime_guess = { version = "2.0" }
actix-web = { version = "4", optional = true, default-features = false }
rocket = { version = "0.5.0-rc.3", features = ["json"], optional = true }
rocket = { version = "0.5", features = ["json"], optional = true }
axum = { version = "0.7", optional = true }
utoipa = { version = "4", path = "../utoipa" }
serde = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion utoipa-swagger-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ works as a bridge for serving the OpenAPI documentation created with
**Currently implemented boilerplate for:**

* **actix-web** `version >= 4`
* **rocket** `version >=0.5.0-rc.3`
* **rocket** `version >=0.5`
* **axum** `version >=0.7`

Serving Swagger UI is framework independent thus this crate also supports serving the Swagger UI with
Expand Down
2 changes: 1 addition & 1 deletion utoipa-swagger-ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//! **Currently implemented boiler plate for:**
//!
//! * **actix-web** `version >= 4`
//! * **rocket** `version >=0.5.0-rc.3`
//! * **rocket** `version >=0.5`
//! * **axum** `version >=0.6`
//!
//! Serving Swagger UI is framework independent thus this crate also supports serving the Swagger UI with
Expand Down