Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lib/fix_data.yaml for automatic migration with dart fix. #198

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/dart_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
22 changes: 22 additions & 0 deletions lib/fix_data.yaml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions test_fixes/rename_to_validate.dart
Original file line number Diff line number Diff line change
@@ -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);
}
8 changes: 8 additions & 0 deletions test_fixes/rename_to_validate.dart.expect
Original file line number Diff line number Diff line change
@@ -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);
}