-
Notifications
You must be signed in to change notification settings - Fork 59
Object of type 'datetime' is not JSON serializable #50
Comments
@kigsmtua Can you give us steps to reproduce your issue? |
@flavianh when the swagger yaml file has a definition with the u.t.c format as I will show below is when the error actually occurs. Steps to reproduce: "releaseDate": {
"type": "string",
"format": "int32",
"example": "2016-08-29T09:12:33.001Z"
}, My digging shows thats its because of how pyaml understands such a format. While parsing it will give an instance of the datetime object which swagger validator library seems not to understand when yaml.load is called it returns that field as below . datetime.datetime(2016, 8, 29, 9, 12, 33, 1000) I would glad to pull a pr if you can guide on how we can go about this |
|
@flavianh swagger file https://app.swaggerhub.com/apis/kigsmtua/housewives/1.0.0 default swagger file on swagger hub |
@flavianh running code from swagger_parser import SwaggerParser
try:
parser = SwaggerParser(swagger_path='sample.yaml')
except Exception as e:
print(str(e)) |
I will try to reproduce and fix your issue, thanks for reporting this |
I've got the same issue. I can easily push a sample repo as I'm VERY early days into a project and this is the first thing I did :-) |
unable to parse valid file with error Object of type 'datetime' is not JSON serializable
The text was updated successfully, but these errors were encountered: