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

Fix #1242 Dot Pathing in data file paths #1912

Merged
merged 2 commits into from
May 10, 2022

Conversation

Snapstromegon
Copy link
Member

@Snapstromegon Snapstromegon commented Jul 29, 2021

Dots in the global datafile path leads to data beeing incorrectly nested.
This commits changes the behavior so a datafile a.b.json will create an entry with data["a.b"] instead of data.a.b.
The old behavior was a bug according to #1242.

The implementation makes use of lodashs set and get functions which also take object paths in array form instead of string. That way we can implement this safely.

fixes #1242

Dots in the global datafile path leads to data beeing incorrectly nested.
This commits changes the behavior so a datafile a.b.json will create an entry with data["a.b"] instead of data.a.b.
The old behavior was a bug according to 11ty#1242.

The implementation makes use of lodashs set and get functions which also take object paths in array form instead of string. That way we can implement this safely.

Signed-off-by: Raphael Höser <raphael@hoeser.info>
This commit adds an additional testcase for 11ty#1242 to avoid future regressions.

Signed-off-by: Raphael Höser <raphael@hoeser.info>
@Snapstromegon
Copy link
Member Author

I think this PR introduces a major version bump change, because it breaks compatibility to existing projects that might use the bug this fixes as a feature. Because of this I would recommend to either make the "bug" in #1242 an official feature, or to include this in 1.0.

@zachleat zachleat added this to the Eleventy 2.0.0 milestone May 10, 2022
@zachleat zachleat merged commit fe1036d into 11ty:master May 10, 2022
@zachleat zachleat added the breaking-change This will have to be included with a major version as it breaks backwards compatibility. label May 10, 2022
@zachleat
Copy link
Member

It’s happening!! Thank you! 2.0.0-canary.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This will have to be included with a major version as it breaks backwards compatibility.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dots in Global Data Files are used for dot-pathing instead of preserved in key name
2 participants