swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.03k stars 6.03k forks source link

[Dart] Unable to generate fromJson method for list of date time #9440

Open SaeedMasoumi opened 5 years ago

SaeedMasoumi commented 5 years ago

If the swagger response contains a list of DateTime objects, It generates the wrong method for parsing from JSON.

For example for the below JSON:

{
  "dates" : [ ... ]
}

It generates:

 MyDto.fromJson(Map<String, dynamic> json) {
    if (json == null) return;
    dates =
      DateTime.listFromJson(json['dates']);
  }

So, the DateTime has no listFromJson method.

I'm using the online editor to generate dart client code.

YannickBiet commented 5 years ago

Any workaround there ?