Created yaml file doesn't have comments on the field with subconfigs.
Here is the code example:
// That's field in OkaeriConfig with Map of subconfigs (another OkaeriConfig impl.)
private Map<String, ChatNotificationChannelConfig> channels = new LinkedHashMap<String, ChatNotificationChannelConfig>() {{
put("default", new ChatNotificationChannelConfig());
put("donate", new ChatNotificationChannelConfig(
30,
Lists.newArrayList("some message"),
false,
false
));
}};
@Getter
@AllArgsConstructor
@NoArgsConstructor
@SuppressWarnings("FieldMayBeFinal")
@Names(strategy = NameStrategy.HYPHEN_CASE, modifier = NameModifier.TO_LOWER_CASE)
public static class ChatNotificationChannelConfig extends OkaeriConfig {
@Comment("Time in seconds for periodically broadcasting")
private int time = 60;
@Comment
@Comment({"line1", "line2"})
private List<String> messages = Lists.newArrayList(
"&8===================================\n" +
"text\n" +
"&8==================================="
);
@Comment
@Comment("Enable this, if you want to restrict channel by permission")
private boolean permissionRequired = false;
@Comment
@Comment("Enable this, if you want messages to be sent randomly")
private boolean randomOrder = false;
}
Config is loaded with:
ConfigManager.create(configClass, config -> {
config.withConfigurer(new OkaeriValidator(new YamlBukkitConfigurer(), true), new SerdesCommons(), new SerdesBukkit());
config.withBindFile(dataFolderPath.resolve(fileName));
config.withRemoveOrphans(true);
config.saveDefaults();
config.load(true);
});
The final yaml file looks like this (there are no comments):
Describe the bug
Created yaml file doesn't have comments on the field with subconfigs. Here is the code example:
Config is loaded with:
The final yaml file looks like this (there are no comments):