diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a84fd3b13..02e4f390e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -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, diff --git a/examples/rocket_okapi_example/README.md b/examples/rocket_okapi_example/README.md index 15b2c0683..78ae61e28 100644 --- a/examples/rocket_okapi_example/README.md +++ b/examples/rocket_okapi_example/README.md @@ -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 diff --git a/examples/rocket_okapi_example/Rocket.toml b/examples/rocket_okapi_example/Rocket.toml index 8ad71194b..3b3ed9650 100644 --- a/examples/rocket_okapi_example/Rocket.toml +++ b/examples/rocket_okapi_example/Rocket.toml @@ -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:" diff --git a/examples/rocket_okapi_example/api/Cargo.toml b/examples/rocket_okapi_example/api/Cargo.toml index e9adc091c..877b6569a 100644 --- a/examples/rocket_okapi_example/api/Cargo.toml +++ b/examples/rocket_okapi_example/api/Cargo.toml @@ -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 diff --git a/examples/rocket_okapi_example/api/src/okapi_example.rs b/examples/rocket_okapi_example/api/src/okapi_example.rs index 3e0f967c7..43c532b4d 100644 --- a/examples/rocket_okapi_example/api/src/okapi_example.rs +++ b/examples/rocket_okapi_example/api/src/okapi_example.rs @@ -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; diff --git a/examples/rocket_okapi_example/dto/Cargo.toml b/examples/rocket_okapi_example/dto/Cargo.toml index 1f08ac4e7..078592ccd 100644 --- a/examples/rocket_okapi_example/dto/Cargo.toml +++ b/examples/rocket_okapi_example/dto/Cargo.toml @@ -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" diff --git a/examples/rocket_okapi_example/entity/Cargo.toml b/examples/rocket_okapi_example/entity/Cargo.toml index fc90fd65c..7f878f9c1 100644 --- a/examples/rocket_okapi_example/entity/Cargo.toml +++ b/examples/rocket_okapi_example/entity/Cargo.toml @@ -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" diff --git a/examples/rocket_okapi_example/service/Cargo.toml b/examples/rocket_okapi_example/service/Cargo.toml index 0178db603..0915684d7 100644 --- a/examples/rocket_okapi_example/service/Cargo.toml +++ b/examples/rocket_okapi_example/service/Cargo.toml @@ -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] diff --git a/sea-orm-rocket/lib/Cargo.toml b/sea-orm-rocket/lib/Cargo.toml index 095cf8a00..b906ae1a0 100644 --- a/sea-orm-rocket/lib/Cargo.toml +++ b/sea-orm-rocket/lib/Cargo.toml @@ -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 = [] \ No newline at end of file