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

Bring back rocket_okapi support #2136

Merged
merged 1 commit into from
Mar 10, 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 .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ jobs:
examples/poem_example,
examples/proxy_gluesql_example,
examples/rocket_example,
# examples/rocket_okapi_example,
examples/rocket_okapi_example,
examples/salvo_example,
examples/seaography_example,
examples/tonic_example,
Expand Down
4 changes: 2 additions & 2 deletions examples/rocket_okapi_example/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Rocket and Rocket-API with SeaORM example app

1. Modify the `url` var in `api/Rocket.toml` to point to your chosen database
1. Modify the `url` var in `api/Rocket.toml` to point to your chosen database (or leave it as-is to use in-memory SQLite)

1. Turn on the appropriate database feature for your chosen db in `service/Cargo.toml` (the `"sqlx-postgres",` line)
1. If not using the SQLite DB: turn on the appropriate database feature for your chosen db in `service/Cargo.toml` (the `"sqlx-postgres",` line)

1. Execute `cargo run` to start the server

Expand Down
6 changes: 5 additions & 1 deletion examples/rocket_okapi_example/Rocket.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ template_dir = "api/templates/"

# Postgres
# make sure to enable "sqlx-postgres" feature in Cargo.toml, i.e default = ["sqlx-postgres"]
url = "postgres://user:pass@localhost:5432/rocket"
# url = "postgres://user:pass@localhost:5432/rocket"

# SQLite
# make sure to enable "sqlx-sqlite" feature in Cargo.toml, i.e default = ["sqlx-sqlite"]
url = "sqlite::memory:"
11 changes: 2 additions & 9 deletions examples/rocket_okapi_example/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ rocket-okapi-example-service = { path = "../service" }
futures = { version = "0.3" }
futures-util = { version = "0.3" }
rocket = { version = "0.5.0", features = ["json"] }
rocket_cors = "0.6.0"
rocket_dyn_templates = { version = "0.1.0-rc.1", features = ["tera"] }
rocket_okapi = { version = "0.8.0", features = ["swagger", "rapidoc", "rocket_db_pools"] }
serde_json = { version = "1" }
entity = { path = "../entity" }
migration = { path = "../migration" }
Expand All @@ -26,12 +28,3 @@ features = [
"rocket_okapi",
] # enables rocket_okapi so to have open api features enabled
# version = "0.5"

[dependencies.rocket_okapi]
version = "0.8.0-rc.2"
features = ["swagger", "rapidoc", "rocket_db_pools"]

[dependencies.rocket_cors]
git = "https://github.com/lawliet89/rocket_cors.git"
rev = "54fae070"
default-features = false
1 change: 0 additions & 1 deletion examples/rocket_okapi_example/api/src/okapi_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use crate::pool;
use pool::Db;

pub use entity::post;
pub use entity::post::Entity as Post;

use rocket_okapi::settings::OpenApiSettings;

Expand Down
2 changes: 1 addition & 1 deletion examples/rocket_okapi_example/dto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ rocket = { version = "0.5.0", features = ["json"] }
path = "../entity"

[dependencies.rocket_okapi]
version = "0.8.0-rc.2"
version = "0.8.0"
2 changes: 1 addition & 1 deletion examples/rocket_okapi_example/entity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ path = "../../../" # remove this line in your own project
version = "1.0.0-rc.1" # sea-orm version

[dependencies.rocket_okapi]
version = "0.8.0-rc.2"
version = "0.8.0"
6 changes: 3 additions & 3 deletions examples/rocket_okapi_example/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ path = "../../../" # remove this line in your own project
version = "1.0.0-rc.1" # sea-orm version
features = [
"runtime-tokio-native-tls",
"sqlx-postgres",
# "sqlx-mysql",
# "sqlx-sqlite",
# "sqlx-postgres",
# "sqlx-mysql",
"sqlx-sqlite",
]

[dev-dependencies]
Expand Down
11 changes: 4 additions & 7 deletions sea-orm-rocket/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ default-features = false
path = "../codegen"
version = "0.5.1"

# [dependencies.rocket_okapi]
# version = "0.8.0-rc.4"
# default-features = false
# optional = true
[dependencies.rocket_okapi]
version = "0.8.0"
default-features = false
optional = true

[dev-dependencies.rocket]
version = "0.5.0"
default-features = false
features = ["json"]

[features]
rocket_okapi = []
Loading