diff --git a/example/lib/main.dart b/example/lib/main.dart index ce2505f..da433e3 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -13,7 +13,6 @@ void main() { typeMappings: {'Pet': 'ExamplePet'}, generatorName: Generator.dio, runSourceGenOnOutput: true, - skipIfSpecIsUnchanged: false, outputDirectory: 'api/petstore_api', ) class MyApp extends StatelessWidget { diff --git a/example/pubspec.lock b/example/pubspec.lock index a85b19f..f4efe0b 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -319,26 +319,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + sha256: "8dcda04c3fc16c14f48a7bb586d4be1f0d1572731b6d81d51772ef47c02081e0" url: "https://pub.dev" source: hosted - version: "10.0.9" + version: "11.0.1" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.9" + version: "3.0.10" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" lints: dependency: transitive description: @@ -560,10 +560,10 @@ packages: dependency: transitive description: name: test_api - sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" url: "https://pub.dev" source: hosted - version: "0.7.4" + version: "0.7.6" timing: dependency: transitive description: @@ -584,10 +584,10 @@ packages: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" vm_service: dependency: transitive description: diff --git a/openapi-generator-annotations/lib/src/openapi_generator_annotations_base.dart b/openapi-generator-annotations/lib/src/openapi_generator_annotations_base.dart index bd9a5c3..052eb44 100644 --- a/openapi-generator-annotations/lib/src/openapi_generator_annotations_base.dart +++ b/openapi-generator-annotations/lib/src/openapi_generator_annotations_base.dart @@ -4,10 +4,6 @@ import 'dart:io'; import 'package:crypto/crypto.dart'; import 'package:meta/meta.dart'; -const skipSpecDepMessage = - 'This will be removed in next major release. This generator will always run' - 'if changes are detected on local spec file. see https://github.com/gibahjoe/openapi-generator-dart#deprecation--breaking-change-notice - Use `forceAlwaysRun` ' - 'to always run the generator regardless of spec changes.'; class Openapi { /// Additional properties to pass to the compiler (CSV) @@ -149,22 +145,10 @@ class Openapi { /// Note: Setting this to `true` can lead to merge conflicts in team environments, /// as each developer may end up modifying the annotated file. /// - /// This setting is different from [skipIfSpecIsUnchanged], which only regenerates - /// the client SDK if it detects changes in the OpenAPI specification. /// /// Defaults to [false]. final bool forceAlwaysRun; - /// Skips execution if the OpenAPI specification file is different from a cached copy. - /// - /// For remote specifications, the file will be downloaded and cached locally. - /// The cache is then compared to the remote file to detect any changes. - /// - /// If set to false, a cached copy of the OpenAPI specification file is not kept. - /// - /// Defaults to [false]. - @Deprecated(skipSpecDepMessage) - final bool skipIfSpecIsUnchanged; const Openapi({ this.additionalProperties, @@ -188,7 +172,6 @@ class Openapi { this.projectPubspecPath, this.debugLogging = false, this.forceAlwaysRun = false, - @Deprecated(skipSpecDepMessage) this.skipIfSpecIsUnchanged = true, }); @override @@ -250,7 +233,6 @@ class Openapi { } buffer.writeln(' debugLogging: $debugLogging,'); buffer.writeln(' forceAlwaysRun: $forceAlwaysRun,'); - buffer.writeln(' skipIfSpecIsUnchanged: $skipIfSpecIsUnchanged,'); buffer.write(')'); return buffer.toString(); } diff --git a/openapi-generator-annotations/test/openapi_generator_annotations_test.dart b/openapi-generator-annotations/test/openapi_generator_annotations_test.dart index 21e6e0a..9672415 100644 --- a/openapi-generator-annotations/test/openapi_generator_annotations_test.dart +++ b/openapi-generator-annotations/test/openapi_generator_annotations_test.dart @@ -30,7 +30,6 @@ void main() { expect(props.debugLogging, isFalse); expect(props.nameMappings, isNull); expect(props.enumNameMappings, isNull); - expect(props.skipIfSpecIsUnchanged, isTrue); }); group('NextGen', () { test('Sets cachePath', () { @@ -391,14 +390,6 @@ void main() { expect(openapi.toString(), contains('forceAlwaysRun: true')); }); - test('should include skipIfSpecIsUnchanged when set', () { - final openapi = Openapi( - skipIfSpecIsUnchanged: true, - inputSpec: InputSpec(path: 'example_path'), - generatorName: Generator.dart, - ); - expect(openapi.toString(), contains('skipIfSpecIsUnchanged: true')); - }); }); group('InputSpec.toString', () { diff --git a/openapi-generator/lib/src/models/generator_arguments.dart b/openapi-generator/lib/src/models/generator_arguments.dart index 4414eec..939273f 100644 --- a/openapi-generator/lib/src/models/generator_arguments.dart +++ b/openapi-generator/lib/src/models/generator_arguments.dart @@ -20,9 +20,6 @@ class GeneratorArguments { /// The default location is: .dart_tool/openapi-generator-cache.json final String cachePath; - /// Informs the generator to disable the cache. - @Deprecated(skipSpecDepMessage) - final bool skipIfSpecIsUnchanged; final bool isDebug; @@ -137,9 +134,7 @@ class GeneratorArguments { '${Directory.current.path}${Platform.pathSeparator}pubspec.yaml'), isDebug = annotations.readPropertyOrDefault('debugLogging', false), inputSpec = - annotations.readPropertyOrDefault('inputSpec', InputSpec.json()), - skipIfSpecIsUnchanged = - annotations.readPropertyOrDefault('skipIfSpecIsUnchanged', false); + annotations.readPropertyOrDefault('inputSpec', InputSpec.json()); /// The stringified name of the [Generator]. String get generatorName => generator == Generator.dart diff --git a/openapi-generator/lib/src/openapi_generator_runner.dart b/openapi-generator/lib/src/openapi_generator_runner.dart index 4f5585d..3f3b27d 100755 --- a/openapi-generator/lib/src/openapi_generator_runner.dart +++ b/openapi-generator/lib/src/openapi_generator_runner.dart @@ -215,17 +215,7 @@ class OpenapiGenerator extends GeneratorForAnnotation { } } - if (!builderCanReadSpec) { - if (args.skipIfSpecIsUnchanged && !await hasDiff(args: args)) { - logOutputMessage( - log: log, - communication: OutputMessage( - message: 'No diff between versions, not running generator.', - ), - ); - return ''; - } - } + // Skip spec check removed - deprecated functionality await runOpenApiJar(arguments: args); await fetchDependencies(baseCommand: baseCommand, args: args); @@ -242,45 +232,7 @@ class OpenapiGenerator extends GeneratorForAnnotation { ), ), ); - if (!builderCanReadSpec) { - if (!args.skipIfSpecIsUnchanged) { - logOutputMessage( - log: log, - communication: OutputMessage( - message: - 'Skip spec cache because [skipIfSpecIsUnchanged] is set to false', - ), - ); - return ''; - } else { - if (!args.hasLocalCache) { - logOutputMessage( - log: log, - communication: OutputMessage( - message: 'No local cache found. Creating one.', - level: Level.CONFIG, - ), - ); - } else { - logOutputMessage( - log: log, - communication: OutputMessage( - message: 'Local cache found. Overwriting existing one.', - level: Level.CONFIG, - ), - ); - } - await cacheSpec( - outputLocation: args.cachePath, - spec: await loadSpec(specConfig: args.inputSpec)); - logOutputMessage( - log: log, - communication: OutputMessage( - message: 'Successfully cached spec changes.', - ), - ); - } - } + // Cache handling removed - deprecated functionality } catch (e, st) { logOutputMessage( log: log, diff --git a/openapi-generator/test/github_issues_test.dart b/openapi-generator/test/github_issues_test.dart index 6e6e1cb..2528c49 100644 --- a/openapi-generator/test/github_issues_test.dart +++ b/openapi-generator/test/github_issues_test.dart @@ -334,7 +334,6 @@ void main() { typeMappings: {'Pet': 'ExamplePet'}, generatorName: Generator.dio, runSourceGenOnOutput: true, - skipIfSpecIsUnchanged: false, cleanSubOutputDirectory: [ './test/specs/issue/$issueNumber/output' ], @@ -377,7 +376,6 @@ void main() { generatorName: Generator.dio, runSourceGenOnOutput: true, typeMappings: {'Pet': 'ExamplePet', 'Test': 'ExampleTest'}, - skipIfSpecIsUnchanged: false, cleanSubOutputDirectory: [ './test/specs/issue/$issueNumber/output' ],