Skip to content

Conversation

@aig787
Copy link
Contributor

@aig787 aig787 commented May 5, 2025

Checklist

Related issue

Fixes #761

Overview

Removes tuono_lib::Request in favor of using axum::extract::Request directly. This allows handler methods to specify arbitrary extractors as parameters.

@aig787 aig787 requested a review from Valerioageno as a code owner May 5, 2025 14:57
@github-actions github-actions bot added the rust Requires rust knowledge label May 5, 2025
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"] }
Copy link
Member

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 {
Copy link
Member

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 {
Copy link
Member

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?

Copy link
Contributor Author

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 {
Copy link
Member

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

@Valerioageno
Copy link
Member

Hey @aig787, sorry for the late reply. I cannot allocate too much time on this project right now.
I'm not sure if this is the right solution for allowing extractors on tuono's handlers. I think we should take a look to tower services still before fallback to this. Unfortunately, I can't investigate on this now. Let me know if you are interested on that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Requires rust knowledge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request]: Allow axum extractor in tuono handlers

2 participants