Bring back rocket_okapi support (#2136)

This commit is contained in:
Mateusz Maćkowski 2024-03-10 23:51:01 +00:00 committed by GitHub
parent a5b3759e96
commit b1f0a81672
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 19 additions and 26 deletions

View File

@ -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,

View File

@ -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

View File

@ -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:"

View File

@ -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" }
@ -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

View File

@ -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;

View File

@ -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"

View File

@ -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"

View File

@ -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]

View File

@ -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 = []