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

Minor inconsistency issue with dataset serialize/deserialize #174

Open
veex-ua opened this issue Dec 26, 2018 · 0 comments
Open

Minor inconsistency issue with dataset serialize/deserialize #174

veex-ua opened this issue Dec 26, 2018 · 0 comments
Assignees
Labels
accepted Issue has been accepted and inserted in a future milestone

Comments

@veex-ua
Copy link

veex-ua commented Dec 26, 2018

DataSet.Utils.AsJSONArray method calls TMVCJsonDataObjectsSerializer.SerializeDataSet method with hard-coded ncLowerCase parameter.

Result := lSerializer.SerializeDataSet(Self, [], ncLowerCase);

Serializer.JsonDataObjects.TMVCJsonDataObjectsSerializer.DeserializeDataSet method, by default, will not lower case target datasets' field names (ncAsIs).
procedure DeserializeDataSet(const ASerializedDataSet: string; const ADataSet: TDataSet;
const AIgnoredFields: TMVCIgnoredList = []; const ANameCase: TMVCNameCase = ncAsIs);

As a result, field names in serialized dataset string (which are lower cased due to ncLowerCase) are matched against target datasets' field names (which are not guaranteed to be lower cased due to ncAsIs). We have to explicitly specify ncLowerCase as last parameter of DeserializeDataSet method, otherwise deserialization might produce wrong result (only empty records are created).

If DataSet.Utils.AsJSONArray method used ncAsIs instead of ncLowerCase we wouldn't have to explicitly specify ANameCase argument when calling DeserializeDataSet. This would also be consistent with how AsJSONObject <> DeserializeDataSetRecord is functioning right now (both methods use ncAsIs).

The issue is pretty minor and this change might break existing code bases. It might be a good idea to include this tweak in 3.1 and mention it in breaking changes list. Happy Holidays 🎅

@danieleteti danieleteti added this to the 3.1.1 (beryllium) milestone Jan 18, 2019
@danieleteti danieleteti self-assigned this Jan 18, 2019
@danieleteti danieleteti added the accepted Issue has been accepted and inserted in a future milestone label Jan 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Issue has been accepted and inserted in a future milestone
Projects
None yet
Development

No branches or pull requests

2 participants