juhaku / utoipa

Simple, Fast, Code first and Compile time generated OpenAPI documentation for Rust
Apache License 2.0
2.21k stars 170 forks source link

Params Vec<String> are not passed to swaggerUI correctly #806

Open DerZwergGimli opened 10 months ago

DerZwergGimli commented 10 months ago
    #[derive(Debug, Deserialize, IntoParams)]
    pub struct VecTEST {
        mint_assets: Vec<std::string::String>,
    }

  #[utoipa::path(
    get,
    path = "/vec_test",
    params(VecTEST),
    responses(
    (status = 200, description = "List todos successfully")
    )
    )]
    pub async fn vec_test(query: VecTEST) -> Result<impl Reply, Infallible> {
        Ok(warp::reply::json(&json!(query.mint_assets)))
    }
utoipa = { version = "4.1.0", features = ["chrono"] }
utoipa-swagger-ui = "4.0.0"

results in this swagger-ui:

image

dayvejones commented 9 months ago

Does the Warp work with arrays in the query parameters correctly?

Most frameworks without crutches do not work with arrays in the query parameters and offer to work with POST for pass arrays

DerZwergGimli commented 9 months ago

Ok then i will try to change that from a GET to a POST and come back if there are still issues