Repository: netwo-io/apistos (rust)

Issue:
Usage of Actix-Specific Features Without Actix Feature Flag
I've noticed that Actix-specific components like `Either` are being used outside the scope of the `actix` feature flag, which could lead to issues in non-Actix environments where the feature is not enabled. 

For instance, in this snippet from [this file](https://github.com/netwo-io/apistos/blob/c21d1658e21796f7134e05682d544a5730b0996c/apistos-core/src/api_component.rs#L4):

```rust
#[cfg(feature = "actix")]
use crate::{PathItemDefinition, ResponseWrapper};
use actix_web::Either;
```
The `Either` type is used without proper feature gating. 

**Expected Behavior**:  
Actix-specific imports and types should be guarded by the appropriate `#[cfg(feature = "actix")]` to ensure compatibility with non-Actix environments.

**Steps to Reproduce**:  
Try to compile `apistos-core` without the `actix` feature enabled, and errors related to `actix_web::Either` will occur.

**Proposed Solution**:  
Wrap all Actix-related imports and code with `#[cfg(feature = "actix")]` to ensure they are only included when the feature is enabled.


Pull request description:
Fix leaking actix type not behind actix feature
Fix #133 

Patch:
diff --git a/Cargo.toml b/Cargo.toml
index 8566b28..cf85876 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,7 +22,7 @@ documentation = "https://docs.rs/apistos/"
 license = "MIT OR Apache-2.0"
 rust-version = "1.75"
 publish = true
-version = "0.4.0"
+version = "0.4.1"
 
 [workspace.dependencies]
 actix-service = "2"
diff --git a/apistos-core/Cargo.toml b/apistos-core/Cargo.toml
index 5605a37..7a68935 100644
--- a/apistos-core/Cargo.toml
+++ b/apistos-core/Cargo.toml
@@ -14,7 +14,7 @@ rust-version.workspace = true
 license.workspace = true
 
 [dependencies]
-pin-project = { workspace = true }
+pin-project = { workspace = true, optional = true }
 schemars = { workspace = true }
 
 actix-web = { workspace = true, optional = true }
@@ -29,18 +29,17 @@ serde_qs = { workspace = true, features = ["actix4"], optional = true }
 uuid = { workspace = true, optional = true }
 url = { workspace = true, optional = true }
 
-apistos-models = { path = "../apistos-models", version = "0.4.0", features = ["deserialize"] }
+apistos-models = { path = "../apistos-models", version = "0.4.1", features = ["deserialize"] }
 
 [dev-dependencies]
 assert-json-diff = { workspace = true }
-serde = { workspace = true }
 serde_json = { workspace = true }
 
 [lints]
 workspace = true
 
 [features]
-actix = ["dep:actix-web"]
+actix = ["dep:actix-web", "dep:pin-project"]
 actix-web-grants = ["dep:actix-web-grants"]
 
 # query related features
diff --git a/apistos-core/src/api_component.rs b/apistos-core/src/api_component.rs
index ac20057..2199f4e 100644
--- a/apistos-core/src/api_component.rs
+++ b/apistos-core/src/api_component.rs
@@ -1,12 +1,15 @@
 use crate::ApiErrorComponent;
 #[cfg(feature = "actix")]
 use crate::{PathItemDefinition, ResponseWrapper};
+#[cfg(feature = "actix")]
 use actix_web::Either;
 use apistos_models::paths::{MediaType, Parameter, RequestBody, Response, Responses};
 use apistos_models::reference_or::ReferenceOr;
 use apistos_models::security::SecurityScheme;
 use apistos_models::Schema;
-use schemars::schema::{ArrayValidation, InstanceType, SchemaObject, SingleOrVec, SubschemaValidation};
+#[cfg(feature = "actix")]
+use schemars::schema::SubschemaValidation;
+use schemars::schema::{ArrayValidation, InstanceType, SchemaObject, SingleOrVec};
 use std::collections::BTreeMap;
 #[cfg(feature = "actix")]
 use std::future::Future;
@@ -176,6 +179,7 @@ where
   }
 }
 
+#[cfg(feature = "actix")]
 impl<T, E> ApiComponent for Either<T, E>
 where
   T: ApiComponent,
diff --git a/apistos-rapidoc/Cargo.toml b/apistos-rapidoc/Cargo.toml
index 4c72667..546f5d6 100644
--- a/apistos-rapidoc/Cargo.toml
+++ b/apistos-rapidoc/Cargo.toml
@@ -14,7 +14,7 @@ rust-version.workspace = true
 license.workspace = true
 
 [dependencies]
-apistos-plugins = { path = "../apistos-plugins", version = "0.4.0" }
+apistos-plugins = { path = "../apistos-plugins", version = "0.4.1" }
 
 [lints]
 workspace = true
diff --git a/apistos-redoc/Cargo.toml b/apistos-redoc/Cargo.toml
index 35b78a7..ce3ca27 100644
--- a/apistos-redoc/Cargo.toml
+++ b/apistos-redoc/Cargo.toml
@@ -14,7 +14,7 @@ rust-version.workspace = true
 license.workspace = true
 
 [dependencies]
-apistos-plugins = { path = "../apistos-plugins", version = "0.4.0" }
+apistos-plugins = { path = "../apistos-plugins", version = "0.4.1" }
 
 [lints]
 workspace = true
diff --git a/apistos-scalar/Cargo.toml b/apistos-scalar/Cargo.toml
index 496e226..75787c1 100644
--- a/apistos-scalar/Cargo.toml
+++ b/apistos-scalar/Cargo.toml
@@ -14,7 +14,7 @@ rust-version.workspace = true
 license.workspace = true
 
 [dependencies]
-apistos-plugins = { path = "../apistos-plugins", version = "0.4.0" }
+apistos-plugins = { path = "../apistos-plugins", version = "0.4.1" }
 
 [lints]
 workspace = true
diff --git a/apistos-shuttle/Cargo.toml b/apistos-shuttle/Cargo.toml
index 5c1215f..365b887 100644
--- a/apistos-shuttle/Cargo.toml
+++ b/apistos-shuttle/Cargo.toml
@@ -18,7 +18,7 @@ actix-web = { workspace = true }
 num_cpus = { workspace = true }
 shuttle-runtime = { workspace = true }
 
-apistos = { path = "../apistos", version = "0.4.0" }
+apistos = { path = "../apistos", version = "0.4.1" }
 
 [lints]
 workspace = true
diff --git a/apistos-swagger-ui/Cargo.toml b/apistos-swagger-ui/Cargo.toml
index 01f1534..8474d87 100644
--- a/apistos-swagger-ui/Cargo.toml
+++ b/apistos-swagger-ui/Cargo.toml
@@ -14,7 +14,7 @@ rust-version.workspace = true
 license.workspace = true
 
 [dependencies]
-apistos-plugins = { path = "../apistos-plugins", version = "0.4.0" }
+apistos-plugins = { path = "../apistos-plugins", version = "0.4.1" }
 
 [lints]
 workspace = true
diff --git a/apistos/Cargo.toml b/apistos/Cargo.toml
index 9654bc0..56e0140 100644
--- a/apistos/Cargo.toml
+++ b/apistos/Cargo.toml
@@ -26,25 +26,25 @@ schemars = { workspace = true }
 serde = { workspace = true }
 serde_json = { workspace = true }
 
-apistos-core = { path = "../apistos-core", version = "0.4.0" }
-apistos-gen = { path = "../apistos-gen", version = "0.4.0" }
-apistos-models = { path = "../apistos-models", version = "0.4.0" }
-apistos-plugins = { path = "../apistos-plugins", version = "0.4.0" }
-apistos-rapidoc = { path = "../apistos-rapidoc", version = "0.4.0", optional = true }
-apistos-redoc = { path = "../apistos-redoc", version = "0.4.0", optional = true }
-apistos-scalar = { path = "../apistos-scalar", version = "0.4.0", optional = true }
-apistos-swagger-ui = { path = "../apistos-swagger-ui", version = "0.4.0", optional = true }
+apistos-core = { path = "../apistos-core", version = "0.4.1" }
+apistos-gen = { path = "../apistos-gen", version = "0.4.1" }
+apistos-models = { path = "../apistos-models", version = "0.4.1" }
+apistos-plugins = { path = "../apistos-plugins", version = "0.4.1" }
+apistos-rapidoc = { path = "../apistos-rapidoc", version = "0.4.1", optional = true }
+apistos-redoc = { path = "../apistos-redoc", version = "0.4.1", optional = true }
+apistos-scalar = { path = "../apistos-scalar", version = "0.4.1", optional = true }
+apistos-swagger-ui = { path = "../apistos-swagger-ui", version = "0.4.1", optional = true }
 
 
 [dev-dependencies]
 actix-web-lab = { workspace = true }
 garde-actix-web = { workspace = true }
 
-apistos-models = { path = "../apistos-models", version = "0.4.0", features = ["deserialize"] }
-apistos-rapidoc = { path = "../apistos-rapidoc", version = "0.4.0" }
-apistos-redoc = { path = "../apistos-redoc", version = "0.4.0" }
-apistos-scalar = { path = "../apistos-scalar", version = "0.4.0" }
-apistos-swagger-ui = { path = "../apistos-swagger-ui", version = "0.4.0" }
+apistos-models = { path = "../apistos-models", version = "0.4.1", features = ["deserialize"] }
+apistos-rapidoc = { path = "../apistos-rapidoc", version = "0.4.1" }
+apistos-redoc = { path = "../apistos-redoc", version = "0.4.1" }
+apistos-scalar = { path = "../apistos-scalar", version = "0.4.1" }
+apistos-swagger-ui = { path = "../apistos-swagger-ui", version = "0.4.1" }
 
 [lints]
 workspace = true


Test patch:
diff --git a/apistos-gen-test/Cargo.toml b/apistos-gen-test/Cargo.toml
index a513d6c..e5aabc2 100644
--- a/apistos-gen-test/Cargo.toml
+++ b/apistos-gen-test/Cargo.toml
@@ -21,8 +21,8 @@ assert-json-diff = { workspace = true }
 chrono = { workspace = true, features = ["serde"] }
 futures-core = { workspace = true }
 apistos = { path = "../apistos", features = ["multipart", "uuid"] }
-apistos-core = { path = "../apistos-core", version = "0.4.0", features = ["actix-web-grants"] }
-apistos-gen = { path = "../apistos-gen", version = "0.4.0" }
+apistos-core = { path = "../apistos-core", version = "0.4.1", features = ["actix-web-grants"] }
+apistos-gen = { path = "../apistos-gen", version = "0.4.1" }
 # we use the "preserve_order" feature from schemars here following https://github.com/netwo-io/apistos/pull/78
 schemars = { workspace = true, features = ["preserve_order"] }
 serde = { workspace = true, features = ["derive"] }