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

[BUG] Generates List<<List<SomeGet$Response>> instead of List<SomeGet$Response> #711

Open
anasJasim opened this issue Jan 11, 2024 · 0 comments
Assignees
Labels
bug Something isn't working Triage needed

Comments

@anasJasim
Copy link

anasJasim commented Jan 11, 2024

Describe the bug
The code generation process for the OpenAPI Swagger Dart library is producing incorrect output. Instead of generating a response type of List<ItemsGet$Response>, the code generator is generating List<List<ItemsGet$Response>>.

Generated output
File: openapi.swagger.dart

abstract class Openapi extends ChopperService {
    @Get(path: '/items')
    Future<chopper.Response<List<ItemsGet$Response>>> _itemsGet(
        {@Query('tenantUnitId') required int? tenantUnitId});
}
// ...
typedef ItemsGet$Response = List<ItemsGet$Response$Item>;

Expected output
File: openapi.swagger.dart

abstract class Openapi extends ChopperService {
    @Get(path: '/items')
    Future<chopper.Response<ItemsGet$Response>> _itemsGet(
        {@Query('tenantUnitId') required int? tenantUnitId});
}
// ...
typedef ItemsGet$Response = List<ItemsGet$Response$Item>;

Swagger specification link
Link to swagger/OpenApi documentation

build.yaml

targets:
  $default:
    builders:
      swagger_dart_code_generator:
        options:
          input_folder: "lib/openapi/swaggers/"
          output_folder: "lib/openapi/generated_code/"
          input_urls:
            - url: "http://127.0.0.1:3001/openapi.json"

Library version used:
chopper: ^6.1.1
json_annotation: ^4.8.0

build_runner: ^2.3.3
chopper_generator: ^6.0.0
json_serializable: ^6.6.1
swagger_dart_code_generator: ^2.10.4

@anasJasim anasJasim added bug Something isn't working Triage needed labels Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Triage needed
Projects
None yet
Development

No branches or pull requests

3 participants