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
90 stars 38 forks source link

Missing import for File #101

Closed RyanRamchandar closed 10 months ago

RyanRamchandar commented 10 months ago

With the schema:

"paths": {
      "/api/example": {
        "post": {
          "tags": [
            "Instances"
          ],
          "summary": "Creates one or more instances from a file or archive, respectively",
          "requestBody": {
            "content": {
              "multipart/form-data": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "file": {
                      "type": "string",
                      "format": "binary"
                    }
                  }
                },
                "encoding": {
                  "file": {
                    "style": "form"
                  }
                }
              }
            }
          },

The following is generated:

  /// Creates one or more instances from a file or archive, respectively
  @MultiPart()
  @POST('/api/example')
  Future<CreatedInstancesResponse> postExample({
    @Part(name: 'file') File? file,
  });

However, the type File is missing the import to import 'dart:io';:

Undefined class 'File'.
Try changing the name to the name of an existing class, or creating a class with the name 'File'.

It can be added manually, but is there a way to define this beforehand?