Skip to content

Commit

Permalink
prefix request path with base path (#584)
Browse files Browse the repository at this point in the history
Co-authored-by: RB0F31CL <[email protected]>
  • Loading branch information
romainboucher and RB0F31CL authored Apr 20, 2023
1 parent 9c1b1eb commit ab78415
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/src/code_generators/swagger_requests_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase {
return;
}

if (options.addBasePathToRequests) {
path = '${swaggerRoot.basePath}$path';
}

final methodName = _getRequestMethodName(
requestType: requestType,
swaggerRequest: swaggerRequest,
Expand Down
4 changes: 4 additions & 0 deletions lib/src/models/generator_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class GeneratorOptions {
/// Instantiate generator options.
GeneratorOptions({
this.withBaseUrl = true,
this.addBasePathToRequests = false,
this.withConverter = true,
this.ignoreHeaders = false,
this.separateModels = false,
Expand Down Expand Up @@ -46,6 +47,9 @@ class GeneratorOptions {
@JsonKey(defaultValue: true)
final bool withBaseUrl;

@JsonKey(defaultValue: false)
final bool addBasePathToRequests;

@JsonKey(defaultValue: null)
final int? pageWidth;

Expand Down
2 changes: 2 additions & 0 deletions lib/src/models/generator_options.g2.dart

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

0 comments on commit ab78415

Please sign in to comment.