jmcarp / jmcarp/flask-apispec

use_kwargs with fields.DateTime is parsed as string

Open
#227 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
652
Forks
151
PR merge metrics
No merged PRs in 30d

Description

When using `fields.DateTime` in a `use_kwargs` it is rendered as string in swagger/openapi.

```
@use_kwargs(
{
'from': fields.DateTime(
format="rfc",
default=datetime.datetime.now(),
description="The timestamp a vehicle should be available from"
)
}, location='query')
```

Screenshot 2021-09-22 at 21 42 33

When using it inside the swagger editor, it is rendered as `string($date-time)`

Screenshot 2021-09-22 at 21 43 11

**This is more conclusive for developers since the string has a specific format.**

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with the shown use_kwargs and fields.DateTime example, then trace how that parameter is converted into Swagger/OpenAPI output. Confirm that the generated schema represents the timestamp with the specific date-time format rather than only a generic string.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.