utoipa
utoipa copied to clipboard
Looks like format option is ignoring
#[utoipa::path(
get,
path = "/visitors/v1/{start_date}/{end_date}",
...
params(
("start_date", Path, description = "Start date filter", format = DateTime),
("end_date", Path, description = "End date filter", format = Date)
)
)]
The description is showing, but the format is always the string
How does it look in the openapi.json or yaml file?
piece of json
[
{
"name": "start_date",
"in": "path",
"description": "Start date filter",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "end_date",
"in": "path",
"description": "End date filter",
"required": true,
"schema": {
"type": "string"
}
}
]
The same issue if I'm trying to do it via struct
#[derive(Deserialize, IntoParams, utoipa::ToSchema)]
pub struct StartEndDate {
/// Start date filter
#[schema(value_type = String, format = Date)]
pub start_date: String,
/// End date filter
#[schema(value_type = String, format = Date)]
pub end_date: String,
}
the format
is just ignoring in the path
part, whereas schema
looks correct
Interesting, there are some known issues with the IntoParams
but didn't expect this to be one of them. :eyes: Need to check this same time with other IntoParams
improvements.
What framework you are using? Axum? Actix_web? Rocket?
actix_web
Hi @shandak , I added a test in https://github.com/juhaku/utoipa/pull/758 which shows one way of getting these data type formats working in actix-web.
@jayvdb Yeah it seemingly works with the Query
type of parameters, but not with the Path
:facepalm: But there is a fix finally for this one in here #928.