Skip to content

Commit cf8ba5e

Browse files
authored
Merge pull request #4 from anttileppa/master
Added support for templateFolder option
2 parents fb1966b + 542c005 commit cf8ba5e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

openapi-generator-annotations/lib/src/openapi_generator_annotations_base.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ class Openapi {
1313
/// -i
1414
final String inputSpecFile;
1515

16+
/// folder containing the template files
17+
///
18+
/// -t
19+
final String templateDir;
20+
1621
/// Generator to use (dart|dart-jaguar|dart-dio)
1722
///
1823
/// -g, --generator-name
@@ -42,6 +47,7 @@ class Openapi {
4247
this.overwriteExistingFiles,
4348
this.skipValidateSpec = false,
4449
this.inputSpecFile,
50+
this.templateDir,
4551
this.generatorName,
4652
this.outputDirectory,
4753
this.alwaysRun = false});

openapi-generator/lib/src/openapi_generator_runner.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ class OpenapiGenerator extends GeneratorForAnnotation<Openapi> {
3838
command = '$command$separator-i$separator${inputFile}';
3939
}
4040

41+
var templateDir = annotation.read('templateDir')?.stringValue ?? '';
42+
if (inputFile.isNotEmpty) {
43+
command = '$command$separator-t$separator${templateDir}';
44+
}
45+
4146
var generator = annotation.read('generatorName')?.stringValue ?? 'dart';
4247
if (generator != 'dart' &&
4348
generator != 'dart-dio' &&

0 commit comments

Comments
 (0)