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

Table arrays containing primitive arrays unnecessarily serialize inline. #72

Closed
Evan-Walden-ATS opened this issue Oct 2, 2023 · 1 comment
Labels
bug Something isn't working PR welcome User contribution/PR is welcome

Comments

@Evan-Walden-ATS
Copy link

The following TOML file:

[[table_array]]
primitive_list = [4, 5, 6]

When run through the functions Toml.ToModel & Toml.FromModel as follows:

var toml = "[[table_array]]\nprimitive_list = [4, 5, 6]";

var model = Toml.ToModel(toml);
var tomlOut = Toml.FromModel(model);

Results in the following output:

table_array = [{primitive_list = [4, 5, 6]}]

I believe this may be a bug, as it appears that the serialization code otherwise prefers to use the non-inline style wherever possible.

@xoofx xoofx added bug Something isn't working PR welcome User contribution/PR is welcome labels Oct 2, 2023
xoofx added a commit that referenced this issue Nov 23, 2023
@xoofx xoofx removed the bug Something isn't working label Nov 23, 2023
@xoofx
Copy link
Owner

xoofx commented Nov 23, 2023

I think that it's not really a bug but I have pushed a fix ffcc734 to mitigate it.

The problem is that TOML is not a roundtrip-able serialization format. There will be other cases like this.

If you need to be roundtrip-able, it would require to use only the Syntax tree but not the model tree (that doesn't know/store any information about the way things should be serialized back).

@xoofx xoofx closed this as completed Nov 23, 2023
@xoofx xoofx added the bug Something isn't working label Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PR welcome User contribution/PR is welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants