1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! Thin HTTP handlers with automatic DTO extraction and validation.
//!
//! Request input guide (applies to both MVC and CQRS controllers):
//! - `#[body] dto: Create__TYPE__Dto`: JSON body, decoded and validated automatically.
//! Example: POST /__FEATURE__ with {"name":"Munna"} and Content-Type: application/json.
//! - `#[param] id: u64`: path parameter, e.g. #[get("/{id}")] for /__FEATURE__/42.
//! For multiple segments use one tuple or Deserialize struct with matching field names.
//! - `#[query] query: SearchDto`: /__FEATURE__?limit=10; DTO must derive
//! Deserialize, Validate and JsonSchema. Use Option<T> for optional fields.
//! - `headers: axum::http::HeaderMap`: request headers, including Authorization
//! and Cookie. Read with headers.get("authorization"); authentication and cookie
//! parsing require your own logic/middleware. There is no #[headers] marker.
//! - `form: axum::extract::Form<FormDto>`: URL-encoded form body; FormDto derives
//! Deserialize. Call validator explicitly if needed (unlike #[body]/#[query]).
//! - `body: String`: raw UTF-8 text; `body: axum::body::Bytes`: raw binary body.
//! - `context: axum::Extension<MyContext>`: middleware/shared request data;
//! install a matching Extension layer first and derive Clone on MyContext.
//! - `peer: axum::extract::ConnectInfo<std::net::SocketAddr>`: client socket address;
//! serve with into_make_service_with_connect_info::<std::net::SocketAddr>().
//! - `multipart: xecute::upload::Multipart`: file/form uploads; enable xecute's
//! `upload` feature and use #[multipart] on the handler for OpenAPI metadata.
//!
//! Example handler signatures to adapt inside this #[routes] impl:
//! ```ignore
//! #[get("/{id}")]
//! async fn find(&self, #[param] id: u64, #[query] query: SearchDto,
//! headers: axum::http::HeaderMap) -> Json<u64> {
//! // Use id, query and headers in your service or query handler.
//! Json(id)
//! }
//!
//! #[post("/form")]
//! async fn submit(&self, form: axum::extract::Form<FormDto>) -> String {
//! // Pass form.0 to your service or command handler.
//! "Accepted".into()
//! }
//! ```
//! Use at most one body-consuming extractor (JSON, form, text, bytes, multipart,
//! or Request), placed last. Do not combine #[body] with Form or Multipart.
//! Controller state is managed by xecute; inject services through controller fields.
//! #[api], #[body(json = Dto)] and #[resp] describe OpenAPI; parameter #[body]
//! performs extraction. Other HTTP verbs: #[put], #[patch], #[delete], #[head], #[options].
use Arc;
use HttpStatus;
use *;
use *;
use __TYPE__;
use __TYPE__Service;
/// Injectable controller owning the resource route prefix.