Skip to content

Commit bc06852

Browse files
authored
fix: Remove deprecated skipIfSpecIsUnchanged and skipSpecDepMessage (#193)
- Removed skipSpecDepMessage constant completely - Removed skipIfSpecIsUnchanged field from Openapi and GeneratorArguments classes - Removed all conditional logic checking skipIfSpecIsUnchanged - Cleaned up related test cases and example code - Simplified cache handling logic in openapi_generator_runner This completes the removal of the deprecated caching mechanism as announced in the deprecation notice.
1 parent 0892b56 commit bc06852

File tree

7 files changed

+13
-96
lines changed

7 files changed

+13
-96
lines changed

example/lib/main.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ void main() {
1313
typeMappings: {'Pet': 'ExamplePet'},
1414
generatorName: Generator.dio,
1515
runSourceGenOnOutput: true,
16-
skipIfSpecIsUnchanged: false,
1716
outputDirectory: 'api/petstore_api',
1817
)
1918
class MyApp extends StatelessWidget {

example/pubspec.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -319,26 +319,26 @@ packages:
319319
dependency: transitive
320320
description:
321321
name: leak_tracker
322-
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
322+
sha256: "8dcda04c3fc16c14f48a7bb586d4be1f0d1572731b6d81d51772ef47c02081e0"
323323
url: "https://pub.dev"
324324
source: hosted
325-
version: "10.0.9"
325+
version: "11.0.1"
326326
leak_tracker_flutter_testing:
327327
dependency: transitive
328328
description:
329329
name: leak_tracker_flutter_testing
330-
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
330+
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
331331
url: "https://pub.dev"
332332
source: hosted
333-
version: "3.0.9"
333+
version: "3.0.10"
334334
leak_tracker_testing:
335335
dependency: transitive
336336
description:
337337
name: leak_tracker_testing
338-
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
338+
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
339339
url: "https://pub.dev"
340340
source: hosted
341-
version: "3.0.1"
341+
version: "3.0.2"
342342
lints:
343343
dependency: transitive
344344
description:
@@ -560,10 +560,10 @@ packages:
560560
dependency: transitive
561561
description:
562562
name: test_api
563-
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
563+
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
564564
url: "https://pub.dev"
565565
source: hosted
566-
version: "0.7.4"
566+
version: "0.7.6"
567567
timing:
568568
dependency: transitive
569569
description:
@@ -584,10 +584,10 @@ packages:
584584
dependency: transitive
585585
description:
586586
name: vector_math
587-
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
587+
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
588588
url: "https://pub.dev"
589589
source: hosted
590-
version: "2.1.4"
590+
version: "2.2.0"
591591
vm_service:
592592
dependency: transitive
593593
description:

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

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ import 'dart:io';
44
import 'package:crypto/crypto.dart';
55
import 'package:meta/meta.dart';
66

7-
const skipSpecDepMessage =
8-
'This will be removed in next major release. This generator will always run'
9-
'if changes are detected on local spec file. see https://github.com/gibahjoe/openapi-generator-dart#deprecation--breaking-change-notice - Use `forceAlwaysRun` '
10-
'to always run the generator regardless of spec changes.';
117

128
class Openapi {
139
/// Additional properties to pass to the compiler (CSV)
@@ -149,22 +145,10 @@ class Openapi {
149145
/// Note: Setting this to `true` can lead to merge conflicts in team environments,
150146
/// as each developer may end up modifying the annotated file.
151147
///
152-
/// This setting is different from [skipIfSpecIsUnchanged], which only regenerates
153-
/// the client SDK if it detects changes in the OpenAPI specification.
154148
///
155149
/// Defaults to [false].
156150
final bool forceAlwaysRun;
157151

158-
/// Skips execution if the OpenAPI specification file is different from a cached copy.
159-
///
160-
/// For remote specifications, the file will be downloaded and cached locally.
161-
/// The cache is then compared to the remote file to detect any changes.
162-
///
163-
/// If set to false, a cached copy of the OpenAPI specification file is not kept.
164-
///
165-
/// Defaults to [false].
166-
@Deprecated(skipSpecDepMessage)
167-
final bool skipIfSpecIsUnchanged;
168152

169153
const Openapi({
170154
this.additionalProperties,
@@ -188,7 +172,6 @@ class Openapi {
188172
this.projectPubspecPath,
189173
this.debugLogging = false,
190174
this.forceAlwaysRun = false,
191-
@Deprecated(skipSpecDepMessage) this.skipIfSpecIsUnchanged = true,
192175
});
193176

194177
@override
@@ -250,7 +233,6 @@ class Openapi {
250233
}
251234
buffer.writeln(' debugLogging: $debugLogging,');
252235
buffer.writeln(' forceAlwaysRun: $forceAlwaysRun,');
253-
buffer.writeln(' skipIfSpecIsUnchanged: $skipIfSpecIsUnchanged,');
254236
buffer.write(')');
255237
return buffer.toString();
256238
}

openapi-generator-annotations/test/openapi_generator_annotations_test.dart

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ void main() {
3030
expect(props.debugLogging, isFalse);
3131
expect(props.nameMappings, isNull);
3232
expect(props.enumNameMappings, isNull);
33-
expect(props.skipIfSpecIsUnchanged, isTrue);
3433
});
3534
group('NextGen', () {
3635
test('Sets cachePath', () {
@@ -391,14 +390,6 @@ void main() {
391390
expect(openapi.toString(), contains('forceAlwaysRun: true'));
392391
});
393392

394-
test('should include skipIfSpecIsUnchanged when set', () {
395-
final openapi = Openapi(
396-
skipIfSpecIsUnchanged: true,
397-
inputSpec: InputSpec(path: 'example_path'),
398-
generatorName: Generator.dart,
399-
);
400-
expect(openapi.toString(), contains('skipIfSpecIsUnchanged: true'));
401-
});
402393
});
403394

404395
group('InputSpec.toString', () {

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ class GeneratorArguments {
2020
/// The default location is: .dart_tool/openapi-generator-cache.json
2121
final String cachePath;
2222

23-
/// Informs the generator to disable the cache.
24-
@Deprecated(skipSpecDepMessage)
25-
final bool skipIfSpecIsUnchanged;
2623

2724
final bool isDebug;
2825

@@ -137,9 +134,7 @@ class GeneratorArguments {
137134
'${Directory.current.path}${Platform.pathSeparator}pubspec.yaml'),
138135
isDebug = annotations.readPropertyOrDefault('debugLogging', false),
139136
inputSpec =
140-
annotations.readPropertyOrDefault('inputSpec', InputSpec.json()),
141-
skipIfSpecIsUnchanged =
142-
annotations.readPropertyOrDefault('skipIfSpecIsUnchanged', false);
137+
annotations.readPropertyOrDefault('inputSpec', InputSpec.json());
143138

144139
/// The stringified name of the [Generator].
145140
String get generatorName => generator == Generator.dart

openapi-generator/lib/src/openapi_generator_runner.dart

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,7 @@ class OpenapiGenerator extends GeneratorForAnnotation<annots.Openapi> {
215215
}
216216
}
217217

218-
if (!builderCanReadSpec) {
219-
if (args.skipIfSpecIsUnchanged && !await hasDiff(args: args)) {
220-
logOutputMessage(
221-
log: log,
222-
communication: OutputMessage(
223-
message: 'No diff between versions, not running generator.',
224-
),
225-
);
226-
return '';
227-
}
228-
}
218+
// Skip spec check removed - deprecated functionality
229219

230220
await runOpenApiJar(arguments: args);
231221
await fetchDependencies(baseCommand: baseCommand, args: args);
@@ -242,45 +232,7 @@ class OpenapiGenerator extends GeneratorForAnnotation<annots.Openapi> {
242232
),
243233
),
244234
);
245-
if (!builderCanReadSpec) {
246-
if (!args.skipIfSpecIsUnchanged) {
247-
logOutputMessage(
248-
log: log,
249-
communication: OutputMessage(
250-
message:
251-
'Skip spec cache because [skipIfSpecIsUnchanged] is set to false',
252-
),
253-
);
254-
return '';
255-
} else {
256-
if (!args.hasLocalCache) {
257-
logOutputMessage(
258-
log: log,
259-
communication: OutputMessage(
260-
message: 'No local cache found. Creating one.',
261-
level: Level.CONFIG,
262-
),
263-
);
264-
} else {
265-
logOutputMessage(
266-
log: log,
267-
communication: OutputMessage(
268-
message: 'Local cache found. Overwriting existing one.',
269-
level: Level.CONFIG,
270-
),
271-
);
272-
}
273-
await cacheSpec(
274-
outputLocation: args.cachePath,
275-
spec: await loadSpec(specConfig: args.inputSpec));
276-
logOutputMessage(
277-
log: log,
278-
communication: OutputMessage(
279-
message: 'Successfully cached spec changes.',
280-
),
281-
);
282-
}
283-
}
235+
// Cache handling removed - deprecated functionality
284236
} catch (e, st) {
285237
logOutputMessage(
286238
log: log,

openapi-generator/test/github_issues_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ void main() {
334334
typeMappings: {'Pet': 'ExamplePet'},
335335
generatorName: Generator.dio,
336336
runSourceGenOnOutput: true,
337-
skipIfSpecIsUnchanged: false,
338337
cleanSubOutputDirectory: [
339338
'./test/specs/issue/$issueNumber/output'
340339
],
@@ -377,7 +376,6 @@ void main() {
377376
generatorName: Generator.dio,
378377
runSourceGenOnOutput: true,
379378
typeMappings: {'Pet': 'ExamplePet', 'Test': 'ExampleTest'},
380-
skipIfSpecIsUnchanged: false,
381379
cleanSubOutputDirectory: [
382380
'./test/specs/issue/$issueNumber/output'
383381
],

0 commit comments

Comments
 (0)