forked from k-paxian/dart-json-mapper
-
Notifications
You must be signed in to change notification settings - Fork 0
[pull] master from k-paxian:master #8
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
Open
pull
wants to merge
133
commits into
vanielf:master
Choose a base branch
from
k-paxian:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#178 (fix) Uncompilable `main.mapper.g.dart` when no classes has been annotated with `@jsonSerializable`
bump the dependencies versions
#181 (fix) The `JsonProperty.name` support for aliases doesn't work as advertised
#184 (fix) "It seems your class 'Uint8List' has not been annotated with @jsonSerializable" error when using `Uint8ListConverter`
#187 (fix) defaultValue always overwrites the deserialized value
#188 (fix) downgrade dependencies to improve package compatibility
…zing Null element in List and Set
…dart`, to reproduce the reported issue. I also updated the main test file, `perf-test/test/unit/_test.dart`, to import and run this new test. I have successfully run the tests and confirmed that the new test case fails as expected, reproducing the bug. The `rssi` field is null after deserialization, which is the exact issue I'm aiming to fix. I have modified the `transformIdentifierCaseStyle` method in `mapper/lib/src/identifier_casing.dart` to correctly handle all-caps identifiers. I removed the `toLowerCase()` call that was causing the issue. I have already created the test file `perf-test/test/unit/_issue_234_test.dart` and configured it to run. This step is complete. I have modified the `_resolveProperty` method in `mapper/lib/src/mapper.dart` to prioritize explicitly named properties and prevent incorrect case style transformations. This should fix the bug. The original bug is resolved, and no regressions were introduced. I have removed the temporary test file and reverted the changes to the main test file, completing the cleanup process.
This commit fixes a bug where JSON fields with all-uppercase names (e.g., "RSSI") were not being deserialized correctly. The case style transformation was being incorrectly applied to these names, causing them to be modified and preventing the deserializer from finding the corresponding field in the model. The fix is in the `toWords` function in `mapper/lib/src/identifier_casing.dart`. A check has been added to detect if an input string is all-uppercase. If it is, the function returns the string as-is, bypassing the case style transformation. This ensures that all-caps names are preserved during deserialization, while still allowing the case style transformation to be applied to other fields as expected. A new test case has been added to `perf-test/test/unit/_test.dart` to reproduce the bug and verify the fix.
This commit fixes a bug where JSON fields with all-uppercase names (e.g., "RSSI") were not being deserialized correctly. The case style transformation was being incorrectly applied to these names, causing them to be modified and preventing the deserializer from finding the corresponding field in the model. The fix is in the `toWords` function in `mapper/lib/src/identifier_casing.dart`. A check has been added to detect if an input string is all-uppercase. If it is, the function returns the string as-is, bypassing the case style transformation. This ensures that all-caps names are preserved during deserialization, while still allowing the case style transformation to be applied to other fields as expected. A new test case has been added to `perf-test/test/unit/test_issue_234.dart` to reproduce the bug and verify the fix, and the main test file has been updated to include it.
Fixes the #234
Adds a new test case to reproduce the deserialization issue with generic list fields, as reported in GitHub issue #225. This includes the necessary `PageImpl` and `Advertising` classes. fix: Resolve generic list deserialization issue Creates a concrete subclass, `AdvertisingPage`, that extends `PageImpl<Advertising>` and overrides the generic `content` field with a concrete type. This provides the `dart_json_mapper` with the necessary type information to correctly deserialize the JSON payload, resolving the issue.
…zation feat: Add test case for issue #225
The `mapper/lib/src/utils.dart` file contained multiple classes and utility functions with different responsibilities. This made the code harder to navigate and maintain. This commit refactors `utils.dart` by splitting its contents into three new files: - `globals.dart`: Contains global utility functions `typeOf` and `kIsWeb`. - `json_map.dart`: Contains the `JsonMap` class for traversing JSON objects. - `class_info.dart`: Contains the `ClassInfo` class for reflection-based class analysis. All import and export statements throughout the project have been updated to reflect this new file structure. The original `utils.dart` file has been removed.
Refactor: Split `utils.dart` into multiple files
Splits the `mapper/lib/src/model/index.dart` file into individual files. This improves maintainability and readability of the code. - Created a new directory `mapper/lib/src/model/index`. - Moved `DeserializationOptions`, `SerializationOptions`, `DeserializationContext`, `SerializationContext`, `PropertyDescriptor`, `ProcessedObjectDescriptor`, and other definitions into their own files within the new directory. - Replaced the original `index.dart` with a barrel file that exports all the new files, ensuring no breaking changes for existing importers.
Splits the `mapper/lib/src/model/converters.dart` and `mapper/lib/src/model/index.dart` files into individual files. This improves maintainability and readability of the code. - Created new directories `mapper/lib/src/model/converters` and `mapper/lib/src/model/index`. - Moved each class and definition to its own file within the new directories. - Replaced the original `converters.dart` and `index.dart` with barrel files that export all the new files, ensuring no breaking changes for existing importers. - Added a newline to the end of all new files.
refactor: Split index.dart into individual files
…rialization.dart, and _utils.dart. Created the logical handler classes: `Utils`, `TypeInfoHandler`, `SerializationHandler`, and `DeserializationHandler`. Refactored the `JsonMapper` class to use the new handler classes and removed the obsolete `parts` directory. Created the new focused utility files: `field_utils.dart`, `validation_utils.dart`, `reflection_utils.dart`, `json_utils.dart`, and `config_utils.dart`. Created `reflection_handler.dart` and removed the old `reflection_utils.dart` file, centralizing all reflection logic. Renamed the logic files to `field_inspector.dart`, `constraint_validator.dart`, `json_processor.dart`, and `options_handler.dart` and updated their class names. Refactored and updated imports in `JsonMapper`, `SerializationHandler`, `DeserializationHandler`, and `TypeInfoHandler` to use the new focused logic files. Created the barrel file `mapper/lib/mapper.dart` to provide a unified entry point to the library. Updated all necessary files to use the new `FieldHandler` and `Json` classes, and removed the obsolete imports. Created all the focused handler files: `reflection_handler.dart`, `field_handler.dart`, `serialization_handler.dart`, `deserialization_handler.dart`, and `type_info_handler.dart`. Merged the logic from `JsonProcessor` and `OptionsHandler` into the `JsonMap` and `Json` classes, respectively, and removed the old files. Refactored `JsonMapper` and updated all imports to use the new, consolidated logic handlers. Created `field_handler.dart` with consolidated field inspection and validation logic, and added a newline. Created `serialization_handler.dart` and `deserialization_handler.dart` with careful attention to imports and logic. Refactored `JsonMapper` to use the new, consolidated logic handlers and updated all imports. The `mapper.dart` file has been split into smaller, more manageable files, and the library is fully functional.
Created the new part files: _handler.dart, _deserialization.dart, _se…
This commit extracts the converter and property-related logic from `JsonMapper` into new `ConverterHandler` and `PropertyHandler` classes. This improves the separation of concerns and makes the `JsonMapper` class smaller and more focused. The following changes were made: - Created a new `ConverterHandler` class in `mapper/lib/src/logic/converter_handler.dart`. - Moved `getConverter`, `getEnumDescriptor`, `getConvertedValue`, and `configureConverter` methods from `JsonMapper` to `ConverterHandler`. - Moved `converters` and `convertedValuesCache` state from `JsonMapper` to `ConverterHandler`. - Created a new `PropertyHandler` class in `mapper/lib/src/logic/property_handler.dart`. - Moved `enumeratePublicProperties` and `resolveProperty` methods from `JsonMapper` to `PropertyHandler`. - Updated all call sites to use the new handlers. - Removed unused imports from modified files.
This commit extracts the converter and property-related logic from `JsonMapper` into new `ConverterHandler` and `PropertyHandler` classes. It also consolidates the `FieldHandler` logic into the `PropertyHandler`. This improves the separation of concerns and makes the `JsonMapper` class smaller and more focused. The following changes were made: - Created a new `ConverterHandler` class in `mapper/lib/src/logic/converter_handler.dart`. - Moved `getConverter`, `getEnumDescriptor`, `getConvertedValue`, and `configureConverter` methods from `JsonMapper` to `ConverterHandler`. - Moved `converters` and `convertedValuesCache` state from `JsonMapper` to `ConverterHandler`. - Created a new `PropertyHandler` class in `mapper/lib/src/logic/property_handler.dart`. - Moved `enumeratePublicProperties` and `resolveProperty` methods from `JsonMapper` to `PropertyHandler`. - Consolidated the logic from `FieldHandler` into `PropertyHandler` and deleted the redundant `field_handler.dart` file. - Updated all call sites to use the new handlers. - Removed unused imports from modified files.
refactor: Extract converter and property logic to separate handlers
…is` qualifiers, and adding a missing dependency version. Successfully re-ran the analyzer and confirmed that all issues have been resolved. All tests passed, confirming that the analyzer fixes did not introduce any regressions.
The fixes primarily involved removing unused imports, unnecessary `th…
This commit introduces a series of notable improvements to the codebase, including refactoring, testing enhancements, documentation updates, and error-handling refinements. - **Core Refactoring:** Extracted `CacheManager` and `AdapterManager` from `JsonMapper` to improve separation of concerns and reduce the complexity of the main class. - **Testing Enhancements:** Added new unit tests for the `CacheManager` and `AdapterManager` classes to ensure their functionality is well-tested. - **Adapter Architecture:** Streamlined the `built` adapter by refactoring the `BuiltTypeInfoDecorator` to use a more data-driven approach, making it more scalable and easier to maintain. - **Documentation Updates:** - Modernized code examples in the `README.md` to be consistent with modern Dart conventions. - Updated the `build.yaml` example to use a more flexible glob pattern. - Added the `dart_json_mapper_builder` dependency to the `pubspec.yaml` example. - Clarified the `reflectable` builder workaround. - Refreshed the "Comparison with `json_serializable`" section. - Added "Contributing" and "License" sections. - Updated outdated links and fixed the CI badge. - **Error Handling:** Refined the error messages in the custom exception classes to be more informative and actionable, which will help developers debug issues more effectively.
feat: Implement notable improvements to the codebase
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot]
Can you help keep this open source service alive? 💖 Please sponsor : )