-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Name conflict with actix::web::Json #25
Comments
You can steel use use actix_web::web;
use actix_web_validator::Json;
async fn create(
req: Json<CreateRequest>,
) -> Result<web::Json<CreateResponse>> {} or use actix_web::web::Json;
async fn decreate(
req: actix_web_validator::Json<CreateRequest>,
) -> Result<Json<CreateResponse>> {} |
@singulared Sure, the issue is more aesthetic, but there are still some practical aspects:
|
Btw, you can create a type alias for actix_web_validator::Json in your own code: type ValidatedJson<T> = actix_web_validator::Json<T>; |
Usually if i need define my own types it is just sign of not well defined interface. This issue is a proposal to solve this. |
In fact, this is not a new type, it is just an alias to an existing one. use std::any::TypeId;
struct A;
type B = A;
fn main() {
assert!(TypeId::of::<A>() == TypeId::of::<B>());
} |
Current suggested way is to import json extractor as
use actix_web_validator::Json
andValidatedJson
is deprecated.The problem with this approach
actix::web::Json
used not only asExtractor
, but also asResponder
and usual signature isAs a result it can't be in-place replacement and i have
use actix_web_validator::Json as ValidatedJson
in near all my endpoints.The text was updated successfully, but these errors were encountered: