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 avaje-config-toml #172

Merged
merged 4 commits into from
Sep 9, 2024
Merged

Add avaje-config-toml #172

merged 4 commits into from
Sep 9, 2024

Conversation

Mechite
Copy link
Contributor

@Mechite Mechite commented Sep 6, 2024

Added TOML support. This supports dotted nesting.

It uses a tiny library, tomlj, not to be confused with toml4j
This library has one dependency, on ANTLR, for parsing, which itself has zero dependencies.

avaje-config-toml->tomlj->antlr4-runtime

Example

(from the test):
Given:

key3 = "c"

[one]
key = "a"
key2 = "b"

When:

var parser = new TomlParser();
Map<String, String> map = parser.load(new StringReader(input()));

assertThat(map).hasSize(3);
assertThat(map).containsOnlyKeys("one.key", "one.key2", "key3");
assertThat(map).containsEntry("one.key", "a");
assertThat(map).containsEntry("one.key2", "b");
assertThat(map).containsEntry("key3", "c");

Then:
test passes

Signed-off-by: Mechite <[email protected]>
@Mechite Mechite mentioned this pull request Sep 6, 2024
@Mechite Mechite changed the title Add avaje-config-toml (see #171) Add avaje-config-toml Sep 6, 2024
Copy link
Collaborator

@SentryMan SentryMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat

@rbygrave
Copy link
Contributor

rbygrave commented Sep 8, 2024

I've added a change such that the TomlParser is registered for service loading as a ConfigExtension. If you are happy with that change @Mechite then I think we are good to merge this PR.

@Mechite
Copy link
Contributor Author

Mechite commented Sep 8, 2024

I've added a change such that the TomlParser is registered for service loading as a ConfigExtension. If you are happy with that change @Mechite then I think we are good to merge this PR.

Totally good with it 👍

(I originally, as you likely immediately noticed, cloned the main module, hence the POM, but also, hence not fully understanding or testing the service loading setup.

I just made it pass unit testing, and published PR as an experiment, to see what kind of feedback it gets)

@SentryMan SentryMan merged commit 94d1ffe into avaje:master Sep 9, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants