Skip to content
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

Rocket FromForm support with IntoParams and refactoring ext arguments #222

Closed
juhaku opened this issue Jul 14, 2022 · 0 comments · Fixed by #226
Closed

Rocket FromForm support with IntoParams and refactoring ext arguments #222

juhaku opened this issue Jul 14, 2022 · 0 comments · Fixed by #226
Assignees

Comments

@juhaku
Copy link
Owner

juhaku commented Jul 14, 2022

Currently there is no support for rocket FromForm using IntoParams.

Add support for this behaviour as demonstrated below and discussed here #139 which allows using IntoParams with FromForm rocket derive macro. Also refactor extension arguments so that there is only one type of extension arguments being used across the extensions #217.

#[derive(serde::Deserialize, FromForm, IntoParams)]
#[allow(unused)]
struct QueryParams {
    foo: String,
    bar: i64,
}

#[utoipa::path(
    responses(
        (status = 200, description = "Hello from server")
    ),
    params(
        ("id", description = "Hello id"),
        QueryParams
    )
)]
#[get("/hello/<id>?<rest..>")]
#[allow(unused)]
fn hello(id: i32, rest: QueryParams) -> String {
    "Hello".to_string()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Released
Development

Successfully merging a pull request may close this issue.

1 participant