-
Notifications
You must be signed in to change notification settings - Fork 191
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
Add ServiceConfig to avoid redundancy. #657
Labels
enhancement
New feature or request
Comments
At the moment there is no build in solution for this. But others might have build some sort of macro rules to mitigate the overhead of double definition. Also there is a thrid-party crate that might be useful: #635 and there is one issue that has collected several relative issues together that touches the same topic #662. |
Duplicate #121 |
juhaku
added a commit
that referenced
this issue
Oct 22, 2024
Implements wrappers for `ServiceConfig`, `App`, `Scope` of actix-web. This allows users to create `App` with collecting `paths` and `schemas` recursively without registering them to `#[openapi(...)]` attribute. Example of new supported syntax. ```rust use actix_web::{get, App}; use utoipa_actix_web::{scope, AppExt}; #[derive(utoipa::ToSchema)] struct User { id: i32, } #[utoipa::path(responses((status = OK, body = User)))] #[get("/user")] async fn get_user() -> Json<User> { Json(User { id: 1 }) } let (_, mut api) = App::new() .into_utoipa_app() .service(scope::scope("/api/v1").service(get_user)) .split_for_parts(); ``` Relates #283 Relates #662 Closes #121 Closes #657
juhaku
added a commit
that referenced
this issue
Oct 22, 2024
Implements wrappers for `ServiceConfig`, `App`, `Scope` of actix-web. This allows users to create `App` with collecting `paths` and `schemas` recursively without registering them to `#[openapi(...)]` attribute. Example of new supported syntax. ```rust use actix_web::{get, App}; use utoipa_actix_web::{scope, AppExt}; #[derive(utoipa::ToSchema)] struct User { id: i32, } #[utoipa::path(responses((status = OK, body = User)))] #[get("/user")] async fn get_user() -> Json<User> { Json(User { id: 1 }) } let (_, mut api) = App::new() .into_utoipa_app() .service(scope::scope("/api/v1").service(get_user)) .split_for_parts(); ``` Relates #283 Relates #662 Closes #121 Closes #657
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you please guide on adding
ServiceConfig
instead of manually list the routes to avoid erroneous repetitions?the Configuration is already established at
looking at
we only need to pass that
ServiceConfig
to paths instead of manually list the routes which could be tedious. Could there be a macro or anything you can suggest?The text was updated successfully, but these errors were encountered: