We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am using otoipa with actix and facing some issues
#[derive(OpenApi)] #[openapi( paths(authHandler::login), components(schemas( LoginUserDto, UserLoginResponseDto, Response )), tags( (name = "Rust Authentication Api", description = "Authentication in Rust API") ), modifiers(&SecurityAddon) )] struct ApiDoc; struct SecurityAddon; impl Modify for SecurityAddon { fn modify(&self, openapi: &mut utoipa::openapi::OpenApi) { openapi.components = Some( utoipa::openapi::ComponentsBuilder::new() .security_scheme( "token", SecurityScheme::Http( HttpBuilder::new() .scheme(HttpAuthScheme::Bearer) .bearer_format("JWT") .build(), ), ) .build(), ) } } #[derive(Debug, Clone, Validate, Serialize, Deserialize, Default, ToSchema)] pub struct LoginUserDto { #[validate( email(message = "Invalid email"), length(min = 1, message = "Email is required") )] pub email: String, #[validate(length(min = 1, message = "Password is required"))] pub password: String, } #[utoipa::path( post, path = "/api/auth/login", tag = "Login Endpoint", request_body( content = LoginUserDto, description = "Credentials to log in to your account", example = json!( { "email": "[email protected]", "password": "password123" })), responses( ( status = 200, description = "Login successfull", body= UserLoginResponseDto ), ( status=400, description= "Validation Errors", body= Response ), ( status=500, description= "Internal Server Error", body= Response ), ) )] pub async fn login( app_state: web::Data<AppState>, body: web::Json<LoginUserDto>, ) -> Result<HttpResponse, HttpError> { ... }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am using otoipa with actix and facing some issues
The text was updated successfully, but these errors were encountered: