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] No request body types are generated #265

Closed
masseelch opened this issue Oct 16, 2021 · 9 comments · Fixed by #271 or #280
Closed

[BUG] No request body types are generated #265

masseelch opened this issue Oct 16, 2021 · 9 comments · Fixed by #271 or #280
Assignees
Labels
bug Something isn't working

Comments

@masseelch
Copy link

masseelch commented Oct 16, 2021

Describe the bug
No BodyTypes are generated or of the requestBody. Objectis used on everyPOST/PATCH`.

To Reproduce
Use this openapi.json and run the generator.

Expected behavior
The spec defines a requestBody. The generated code creates a type for the body.

Library version used:

dependencies:
  flutter:
    sdk: flutter
  chopper: ^4.0.1
  flutter_svg: ^0.23.0+1
  json_annotation: ^4.3.0
  provider: ^6.0.1
  shared_preferences: ^2.0.8
  vrouter: ^1.2.0+14
  web_socket_channel: ^2.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  swagger_dart_code_generator: ^2.1.3+1
  chopper_generator: ^4.0.2
  build_runner: ^2.1.2
  json_serializable: ^6.0.0

Additional context
Example of the generated Code.

@override
  Future<Response<DisplayCreateView>> displaysPost(
      {required Object? body}) {
    final $url = '/displays';
    final $body = body;
    final $request = Request('POST', $url, client.baseUrl, body: $body);
    return client.send<DisplayCreateView, DisplayCreateView>($request);
  }
@masseelch masseelch added bug Something isn't working Triage needed labels Oct 16, 2021
Vovanella95 pushed a commit that referenced this issue Oct 19, 2021
fryette added a commit that referenced this issue Oct 20, 2021
* FIX #244

* Update CHANGELOG.md

* Fix test

* Fixed issue #265

Co-authored-by: uladzimir_paliukhovich <>
Co-authored-by: Eugeny Sampir <ysampir@gmail.com>
@Vovanella95
Copy link
Collaborator

Hi @masseelch ,

I will check it today or tomorrow.

@Vovanella95
Copy link
Collaborator

Hi @masseelch Sorry I was sick and did not checked your issue. Will get is as soon as possible

@Vovanella95
Copy link
Collaborator

Hi @masseelch ,

Indeed we did not generated requestBodies injected into requests. I've added this functionality, but there are some bugs. I will fix it soon, anyway Your file generating without issues.

So you can use version/2.2.5 branch in your pubspec.yaml to generate all you need.

@masseelch
Copy link
Author

Hey @Vovanella95, thank you for the quick fix. I will have a look at the branch next week and let you know!

@Vovanella95
Copy link
Collaborator

@masseelch I hope next weak It will be in pub.dev :)

@Vovanella95
Copy link
Collaborator

@masseelch feel free to use 2.2.5 version. Let us know of there are any issues.

@masseelch
Copy link
Author

Hey @Vovanella95, I was sick the whole week and had no time to test. I still will do so and provide feedback. Sorry for the delay.

@Vovanella95
Copy link
Collaborator

@masseelch it's not a problem :)

@masseelch
Copy link
Author

I finally was able to work again. All works as expected. Thank you very much :-)

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
3 participants