Skip to content

Commit

Permalink
🐛 fix chopper_generator regression introduced in #534 (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse committed Jan 8, 2024
1 parent 2dc868f commit 33615ed
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 3 deletions.
26 changes: 26 additions & 0 deletions chopper/test/test_service.chopper.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions chopper/test/test_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,15 @@ abstract class HttpTestService extends ChopperService {
@Header('x-double') double? doubleHeader,
@Header('x-enum') ExampleEnum? enumHeader,
});

@Post(path: 'publish')
@FactoryConverter(request: FormUrlEncodedConverter.requestFactory)
Future<Response<void>> publish(
@Field('review_id') final String reviewId,
@Field() final List<int> negatives,
@Field() final List<int> positives, [
@Field() final String? signature,
]);
}

Request customConvertRequest(Request req) {
Expand Down
4 changes: 1 addition & 3 deletions chopper_generator/lib/src/generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,7 @@ final class ChopperGenerator
// ignore: deprecated_member_use
function.enclosingElement is ClassElement
// ignore: deprecated_member_use
? refer(function.enclosingElement!.name!)
.property(function.name!)
.toString()
? '${function.enclosingElement!.name}.${function.name}'
: function.name!;

static Map<String, ConstantReader> _getAnnotation(
Expand Down
26 changes: 26 additions & 0 deletions chopper_generator/test/test_service.chopper.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions chopper_generator/test/test_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@ abstract class HttpTestService extends ChopperService {
@Header('x-double') double? doubleHeader,
@Header('x-enum') ExampleEnum? enumHeader,
});

@Post(path: 'publish')
@FactoryConverter(request: FormUrlEncodedConverter.requestFactory)
Future<Response<void>> publish(
@Field('review_id') final String reviewId,
@Field() final List<int> negatives,
@Field() final List<int> positives, [
@Field() final String? signature,
]);
}

Request customConvertRequest(Request req) {
Expand Down

0 comments on commit 33615ed

Please sign in to comment.