Closed ghost closed 2 years ago
Hi @robson-araujo-solvimm! Thank you for the issue. Unfortunately, the library doesn't currently support datetime, but I'll add that to the roadmap for the next release 😄
In the mean time, would something like this work for you?:
@ValidateParameters()
def ficha3_download(
cnpj: str = Query(max_str_length=18),
cod_produto: str = Query(),
data_inicio: str = Query(regex="\d{4}-\d{2}-\d{2}"),
data_final: str = Query(regex="\d{4}-\d{2}-\d{2}")
):
# Convert data_inicio and data_final to datetime object from str manually
Thank you @Ge0rg3 for the fast reply! I'll use your suggestion.
Will keep open as a self-reminder to implement datetime parsing :)
Closed in #9!
Hi everyone! I'm trying to validate a date input. My code is:
and the input date is for example "2020-01-01". I keep getting the error
{"error":"Parameter 'data_inicio' must be type 'datetime'"}
Also tried withdate
type but got the same error. Does anyone know how to handle this type of validation?