Skip to content

Commit 37f862c

Browse files
committed
fix: fix gitignore, readd api/petstore_api/pubspec
1 parent 90a1b90 commit 37f862c

File tree

4 files changed

+41
-14
lines changed

4 files changed

+41
-14
lines changed

example/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ app.*.map.json
4444
/android/app/debug
4545
/android/app/profile
4646
/android/app/release
47-
api
47+
api/petstore_api/**
4848
!api/petstore_api/pubspec.yaml
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: petstore_api
2+
version: 1.0.0
3+
description: OpenAPI API client
4+
homepage: homepage
5+
6+
environment:
7+
sdk: '>=2.15.0 <3.0.0'
8+
9+
dependencies:
10+
dio: '^5.0.0'
11+
one_of: '>=1.5.0 <2.0.0'
12+
one_of_serializer: '>=1.5.0 <2.0.0'
13+
built_value: '>=8.4.0 <9.0.0'
14+
built_collection: '>=5.1.1 <6.0.0'
15+
16+
dev_dependencies:
17+
built_value_generator: '>=8.4.0 <9.0.0'
18+
build_runner: any
19+
test: ^1.16.0

openapi-generator/lib/src/models/generator_arguments.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import 'dart:io';
44
import 'package:logging/logging.dart';
55
import 'package:openapi_generator/src/extensions/type_methods.dart';
66
import 'package:openapi_generator/src/models/output_message.dart';
7-
import 'package:openapi_generator/src/utils.dart';
87
import 'package:openapi_generator_annotations/openapi_generator_annotations.dart';
98
import 'package:source_gen/source_gen.dart' as src_gen;
109

10+
import '../utils.dart';
11+
1112
/// The default storage location of the cached copy of the specification.
1213
///
1314
/// When the annotation has the [Openapi.cachePath] set this value isn't used.
@@ -222,10 +223,10 @@ class GeneratorArguments {
222223
/// The arguments to be passed to generator jar file.
223224
FutureOr<List<String>> get jarArgs async => [
224225
'generate',
225-
if (outputDirectory.isNotEmpty) '-o $outputDirectory',
226-
'-i ${await inputFileOrFetch}',
227-
if (templateDirectory.isNotEmpty) '-t $templateDirectory',
228-
'-g $generatorName',
226+
if (outputDirectory.isNotEmpty) '-o=$outputDirectory',
227+
'-i=${await inputFileOrFetch}',
228+
if (templateDirectory.isNotEmpty) '-t=$templateDirectory',
229+
'-g=$generatorName',
229230
if (skipValidation) '--skip-validate-spec',
230231
if (reservedWordsMappings.isNotEmpty)
231232
'--reserved-words-mappings=${reservedWordsMappings.entries.fold('', foldStringMap())}',

openapi-generator/lib/src/openapi_generator_runner.dart

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,17 @@ class OpenapiGenerator extends GeneratorForAnnotation<annots.Openapi> {
128128
// Include java environment variables in openApiCliCommand
129129
var javaOpts = Platform.environment['JAVA_OPTS'] ?? '';
130130

131-
final result = await Process.run('java', [
132-
if (javaOpts.isNotEmpty) javaOpts,
133-
'-jar',
134-
"${"$binPath"}",
135-
...args,
136-
]);
131+
final result = await Process.run(
132+
'java',
133+
[
134+
if (javaOpts.isNotEmpty) javaOpts,
135+
'-jar',
136+
binPath,
137+
...args,
138+
],
139+
workingDirectory: Directory.current.path,
140+
runInShell: Platform.isWindows,
141+
);
137142

138143
if (result.exitCode != 0) {
139144
return Future.error(
@@ -148,8 +153,10 @@ class OpenapiGenerator extends GeneratorForAnnotation<annots.Openapi> {
148153
logOutputMessage(
149154
log: log,
150155
communication: OutputMessage(
151-
message: [result.stdout, ' - :: Codegen completed successfully. ::']
152-
.join('\n'),
156+
message: [
157+
// result.stdout,
158+
' - :: Codegen completed successfully. ::',
159+
].join('\n'),
153160
),
154161
);
155162
}

0 commit comments

Comments
 (0)