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

🐛 fix chopper_generator regression introduced in #534 #549

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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