-
Notifications
You must be signed in to change notification settings - Fork 57
feat: Allow axum extractor in tuono handlers #764
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
base: main
Are you sure you want to change the base?
Conversation
crates/tuono_lib/Cargo.toml
Outdated
| ssr_rs = "0.8.2" | ||
| axum = {version = "0.8.1", features = ["json", "ws"]} | ||
| axum-extra = {version = "0.10.0", features = ["cookie"]} | ||
| axum = { version = "0.8.1", features = ["json", "ws", "form"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd import all the FF
|
|
||
| #[derive(Deserialize)] | ||
| struct Payload { | ||
| pub struct Payload { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
| #modified_request | ||
|
|
||
| #fn_name(req.clone(), #argument_names).await | ||
| pub async fn #api_fn_name(#arguments)#return_type { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we just rename the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow
| let index = i - 1; | ||
| let argument_name = *pat_type.pat.clone(); | ||
| argument_names.insert(index, argument_name.clone()); | ||
| match &*pat_type.pat { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the complexity of the approach, I think a good situation for adding tests
|
Hey @aig787, sorry for the late reply. I cannot allocate too much time on this project right now. |
Checklist
Related issue
Fixes #761
Overview
Removes
tuono_lib::Requestin favor of usingaxum::extract::Requestdirectly. This allows handler methods to specify arbitrary extractors as parameters.