netwo-io / apistos

Actix-web wrapper for automatic OpenAPI 3.0 documentation generation.
MIT License
148 stars 6 forks source link

Usage of Actix-Specific Features Without Actix Feature Flag #133

Closed darkyeg closed 2 months ago

darkyeg commented 2 months ago

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:

#[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.

rlebran commented 2 months ago

Hi, thanks for noticing it. Gonna fix it in the upcoming days.

rlebran commented 2 months ago

Fixed in 0.4.1