Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swagger int32 array is recognized as Dart dynamic if present directly from body in swagger file. #289

Closed
RoarGronmo opened this issue Dec 18, 2021 · 2 comments · Fixed by #280
Assignees
Labels
bug Something isn't working

Comments

@RoarGronmo
Copy link

Describe the bug
Swagger file with this section:

    "/Order/firmCountries": {
      "get": {
        "tags": [
          "Order"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "integer",
                    "format": "int32"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "integer",
                    "format": "int32"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "integer",
                    "format": "int32"
                  }
                }
              }
            }
          }
        }
      }
    },

are recognized as dynamic not i.e. List<int>

BTW: You can recognize and remedy like this:

        var value = response?.body;

        var list_int = List<int>.from(value);

...but it should already have been recognized as List<int>.

Code generated in : *.swagger.dart

  ///
  @Get(path: '/Order/firmCountries')
  Future<chopper.Response> orderFirmCountriesGet();

Code generated in: *.swagger.chopper.dart

  @override
  Future<Response<dynamic>> orderFirmCountriesGet() {
    final $url = '/Order/firmCountries';
    final $request = Request('GET', $url, client.baseUrl);
    return client.send<dynamic, dynamic>($request);
  }

Here I Expected not Future<Response<dynamic>> to be returned, but Future<Response<List<int>>> instead.

To Reproduce
Yaml files
pubspec.yaml.txt
build.yaml.txt

Swagger file:
mwork_api.swagger.txt

Library version used:
2.2.10

@RoarGronmo RoarGronmo added bug Something isn't working Triage needed labels Dec 18, 2021
@Vovanella95
Copy link
Collaborator

Hi @RoarGronmo
thanks for raising and issue. Will try to check it soon!

@Vovanella95
Copy link
Collaborator

Hi @RoarGronmo please check 2.3.0 version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants