I have this action method:
[HttpGet]
public async Task<ActionResult<Agent[]>> Get(DateTime? lastModified = null) {}
I can see that the following swagger json is generated using Swashbuckle.AspNetCore v4.0.1:
"parameters":[{"name":"lastModified","in":"query","required":false,"type":"string","format":"date-time"}]
Why is the type string
?
Shouldn't it be DateTime
?
OpenAPI defines the following basic types: string,number,integer,boolean,array,object.There's no DateTime.
The string
type includes dates and files and the date-time
format is one of string formats.
Refer to
https://swagger.io/docs/specification/data-models/data-types/
https://swagger.io/specification/#dataTypes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With