Carapacik / swagger_parser

Dart package that takes an OpenApi definition file and generates REST clients based on retrofit and data classes for your project.
https://pub.dev/packages/swagger_parser
MIT License
87 stars 33 forks source link

File type not supported by Json Annotation #203

Closed dickermoshe closed 1 month ago

dickermoshe commented 4 months ago

Output:

Could not generate `fromJson` code for `binary`.
To support the type `File` you can:
* Use `JsonConverter`
  https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonConverter-class.html
* Use `JsonKey` fields `fromJson` and `toJson`
  https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/fromJson.html
  https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/toJson.html
dickermoshe commented 4 months ago

@Carapacik What are your thoughts, add the feature or warn against it? btw, why is bytes File, shouldnt it be Uint8List

Then we could use this https://stackoverflow.com/questions/63716036/how-to-serialize-uint8list-to-json-with-json-annotation-in-dart

StarProxima commented 1 month ago

Files are usually used in MiltiPart queries, where their support works correctly (we don't generate a model, but use parameters)