diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e88eed3..714c865 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,7 +20,7 @@ test-default: - cargo/ - target/ -test-all: +test-full: stage: test image: rust:1.42-slim before_script: @@ -28,7 +28,7 @@ test-all: - apt install -y --no-install-recommends libpq-dev - cargo -V script: - - cargo test --workspace --all-features + - cargo test --no-default-features --features full cache: key: cargo-1-42-all paths: @@ -64,7 +64,7 @@ test-trybuild-ui: - apt install -y --no-install-recommends libpq-dev - cargo -V script: - - cargo test --workspace --all-features --tests -- --ignored + - cargo test --no-default-features --features full --tests -- --ignored cache: key: cargo-1-48-all paths: diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a0929d..7248bc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - The cors handler can now copy headers from the request if desired - All fields of `Response` are now private + - If not enabling the `openapi` feature, `without-openapi` has to be enabled ## [0.1.1] - 2020-12-28 ### Added diff --git a/Cargo.toml b/Cargo.toml index 2d7d073..c7ad1b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,11 +46,16 @@ thiserror = "1.0.18" trybuild = "1.0.27" [features] -default = ["cors", "errorlog"] +default = ["cors", "errorlog", "without-openapi"] +full = ["auth", "cors", "database", "errorlog", "openapi"] + auth = ["gotham_restful_derive/auth", "base64", "cookie", "jsonwebtoken"] cors = [] -errorlog = [] database = ["gotham_restful_derive/database", "gotham_middleware_diesel"] +errorlog = [] + +# These features are exclusive - https://gitlab.com/msrd0/gotham-restful/-/issues/4 +without-openapi = [] openapi = ["gotham_restful_derive/openapi", "indexmap", "openapiv3"] [package.metadata.docs.rs] diff --git a/src/lib.rs b/src/lib.rs index 24e8297..9096bbe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -378,6 +378,12 @@ directory, that might help you. Any help writing more examples is highly appreci [`State`]: ../gotham/state/struct.State.html */ +#[cfg(all(feature = "openapi", feature = "without-openapi"))] +compile_error!("The 'openapi' and 'without-openapi' features cannot be combined"); + +#[cfg(all(not(feature = "openapi"), not(feature = "without-openapi")))] +compile_error!("Either the 'openapi' or 'without-openapi' feature needs to be enabled"); + // weird proc macro issue extern crate self as gotham_restful;