Skip to content

Commit bc5af4f

Browse files
committed
- updated dependencies
- added support for pub get and sourcegen config
1 parent fe6d19e commit bc5af4f

File tree

6 files changed

+34
-10
lines changed

6 files changed

+34
-10
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ class Openapi {
4747
/// if set to false (the default), openapi-generator will skip processing if the [outputDirectory] already exists
4848
final bool alwaysRun;
4949

50+
/// if set to true, flutter pub get will be run on the [outputDirectory] after the code has been generated.
51+
/// Defaults to true for backwards compatibility
52+
final bool fetchDependencies;
53+
54+
///if set to true, source gen will be run on the output of openapi-generator
55+
///Defaults to true
56+
final bool runSourceGenOnOutput;
57+
5058
final Map<String, String> typeMappings;
5159

5260
const Openapi(
@@ -59,6 +67,8 @@ class Openapi {
5967
this.outputDirectory,
6068
this.typeMappings,
6169
this.apiPackage,
70+
this.fetchDependencies = true,
71+
this.runSourceGenOnOutput = true,
6272
this.alwaysRun = false});
6373
}
6474

@@ -195,7 +205,9 @@ class DioProperties extends AdditionalProperties {
195205
sourceFolder: sourceFolder,
196206
useEnumExtension: useEnumExtension);
197207
}
208+
198209
enum DioDateLibrary { core, timemachine }
199210
enum SerializationFormat { JSON, PROTO }
211+
200212
/// The name of the generator to use
201213
enum Generator { DART, DART_DIO, DART2_API, DART_JAGUAR }
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: openapi_generator_annotations
22
description: Annotation package for openapi_generator https://pub.dev/packages/openapi_generator.
3-
version: 1.1.1
3+
version: 1.1.2
44
homepage: https://github.com/gibahjoe/openapi-generator-dart
55

66

@@ -9,4 +9,4 @@ environment:
99

1010
dev_dependencies:
1111
pedantic: ^1.9.2
12-
test: ^1.15.3
12+
test: ^1.15.4
4 Bytes
Binary file not shown.

openapi-generator-cli/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: openapi_generator_cli
22
description: A dart wrapper around openapi-generator inspired by the node implementation.
3-
version: 1.1.0
3+
version: 1.1.2
44
homepage: https://github.com/gibahjoe/openapi-generator-dart
55

66
environment:
77
sdk: '>=2.7.0 <3.0.0'
88

99
dev_dependencies:
1010
pedantic: ^1.9.2
11-
test: ^1.15.3
11+
test: ^1.15.4
1212

1313
executables:
1414
openapi-generator: main

openapi-generator/lib/src/openapi_generator_runner.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ class OpenapiGenerator extends GeneratorForAnnotation<annots.Openapi> {
9595
'OpenapiGenerator :: Codegen ${pr.exitCode != 0 ? 'Failed' : 'completed successfully'}');
9696
exitCode = pr.exitCode;
9797

98+
if (!_readFieldValueAsBool(annotation, 'fetchDependencies')) {
99+
print(
100+
'OpenapiGenerator :: Codegen skipping install step because you said so...');
101+
return '';
102+
}
103+
98104
if (exitCode == 0) {
99105
var installOutput = await Process.run('flutter', ['pub', 'get'],
100106
workingDirectory: '$outputDirectory');
@@ -105,6 +111,12 @@ class OpenapiGenerator extends GeneratorForAnnotation<annots.Openapi> {
105111
exitCode = installOutput.exitCode;
106112
}
107113

114+
if (!_readFieldValueAsBool(annotation, 'runSourceGenOnOutput')) {
115+
print(
116+
'OpenapiGenerator :: Codegen skipping source gen step because you said so...');
117+
return '';
118+
}
119+
108120
if (exitCode == 0) {
109121
//run buildrunner to generate files
110122
switch (generatorName) {

openapi-generator/pubspec.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
name: openapi_generator
22
description: Generator for openapi client sdk inspired by the npm impplementation of openapi-generator-cli.
3-
version: 1.1.1
3+
version: 1.1.2
44
homepage: https://github.com/gibahjoe/openapi-generator-dart
55

66
environment:
77
sdk: '>=2.7.0 <3.0.0'
88

99
dependencies:
10-
build: ^1.3.0
11-
source_gen: ^0.9.6
10+
build: '>=1.3.0 <=1.10.3'
11+
source_gen: ^0.9.7+1
1212
path: ^1.7.0
1313
openapi_generator_annotations: ^1.1.1
14-
analyzer: '>=0.39.8 <=0.40.0'
14+
analyzer: '>=0.39.8 <=0.40.1'
1515
openapi_generator_cli: ^1.1.0
1616
generic_reader: ^0.1.5
1717

1818
dev_dependencies:
1919
pedantic: ^1.9.2
2020
build_config: ^0.4.2
21-
build_runner: ^1.9.0
22-
test: ^1.15.3
21+
build_runner: '>=1.3.0 <=1.10.3'
22+
test: ^1.15.4

0 commit comments

Comments
 (0)