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

Component value_type attribute doesn't support Vec, Option, Any, etc #191

Closed
kellpossible opened this issue Jun 26, 2022 · 2 comments · Fixed by #203 or #204
Closed

Component value_type attribute doesn't support Vec, Option, Any, etc #191

kellpossible opened this issue Jun 26, 2022 · 2 comments · Fixed by #203 or #204
Labels
enhancement New feature or request

Comments

@kellpossible
Copy link
Contributor

kellpossible commented Jun 26, 2022

With #187 these attributes can be parsed (without this PR these are compile errors), but the following cases don't appear to be supported correctly:

#[derive(utoipa::Component)]
struct Post {
    #[component(value_type = Vec<String>)]
    value: i64,
}
#[derive(utoipa::Component)]
struct Post {
    #[component(value_type = Option<String>)]
    value: i64,
}
#[derive(utoipa::Component)]
struct Post {
    #[component(value_type = Vec<Any>)]
    value: i64,
}
#[derive(utoipa::Component)]
struct Post {
    #[component(value_type = Option<Foo>)]
    value: i64,
}
#[derive(utoipa::Component)]
struct Post {
    #[component(value_type = Vec<Foo>)]
    value: i64,
}
@juhaku
Copy link
Owner

juhaku commented Jul 2, 2022

Haven't thought someone would use value_type for Vec or Option. 😂 So these cases are not implemented. I guess this needs another round of enhancing to support generic types. I'll try to add a support for them.

@juhaku
Copy link
Owner

juhaku commented Jul 2, 2022

The #203 will implement support for above types for IntoParams but another PR is needed for Component support. That will be done shortly.

@juhaku juhaku moved this to In Progress in utoipa kanban Jul 2, 2022
@juhaku juhaku added the enhancement New feature or request label Jul 2, 2022
This was linked to pull requests Jul 2, 2022
Repository owner moved this from In Progress to Done in utoipa kanban Jul 2, 2022
@juhaku juhaku moved this from Done to Released in utoipa kanban Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Released
Development

Successfully merging a pull request may close this issue.

2 participants