diff --git a/.github/workflows/dart_ci.yaml b/.github/workflows/dart_ci.yaml index 9e6630fc..e655f7ad 100644 --- a/.github/workflows/dart_ci.yaml +++ b/.github/workflows/dart_ci.yaml @@ -38,4 +38,7 @@ jobs: - name: Publish - dry run if: ${{ matrix.sdk == 'stable' }} run: dart pub publish --dry-run --skip-validation - + - name: Test 'dart fix' + # if one of these tests stops working in a future Dart SDK, it may be + # fine to keep entries in lib/fix_data.yaml and just remove the tests. + run: dart fix --compare-to-golden test_fixes/ diff --git a/lib/fix_data.yaml b/lib/fix_data.yaml new file mode 100644 index 00000000..b36a9410 --- /dev/null +++ b/lib/fix_data.yaml @@ -0,0 +1,22 @@ +version: 1 +transforms: +- title: Rename to validate + date: 2024-10-15 + element: + uris: + - json_schema.dart + method: validateWithResults + inClass: Validator + changes: + - kind: rename + newName: validate +- title: Rename to validate + date: 2024-10-15 + element: + uris: + - json_schema.dart + method: validateWithResults + inClass: JsonSchema + changes: + - kind: rename + newName: validate diff --git a/test_fixes/rename_to_validate.dart b/test_fixes/rename_to_validate.dart new file mode 100644 index 00000000..52aab678 --- /dev/null +++ b/test_fixes/rename_to_validate.dart @@ -0,0 +1,8 @@ +import 'package:json_schema/json_schema.dart'; + +void main() { + final schema = JsonSchema.empty(); + schema.validateWithResults(null); + final validator = Validator(schema); + validator.validateWithResults(null); +} diff --git a/test_fixes/rename_to_validate.dart.expect b/test_fixes/rename_to_validate.dart.expect new file mode 100644 index 00000000..c6255eaa --- /dev/null +++ b/test_fixes/rename_to_validate.dart.expect @@ -0,0 +1,8 @@ +import 'package:json_schema/json_schema.dart'; + +void main() { + final schema = JsonSchema.empty(); + schema.validate(null); + final validator = Validator(schema); + validator.validate(null); +}