Carleslc / Simple-YAML

This Java API provides an easy-to-use way to store data and provide configurations using the YAML format.
https://carleslc.me/Simple-YAML
GNU General Public License v3.0
130 stars 38 forks source link

Comments are broken #44

Closed Osiris-Team closed 3 years ago

Osiris-Team commented 3 years ago
Error Message: while scanning a simple key
 in 'string', line 15, column 1:
    ys to 0 if you want to keep your ... 
    ^
could not find expected ':'
 in 'string', line 16, column 13:
        max-days: 7
                ^

Yaml file: (max-days duplicated itself and the # and half of the comment disappeared)

  plugins-backup:
    # Backups your plugins folder before startup to /autoplug-backups/plugins/...zip
    enable: true
    max-days: 7
ys to 0 if you want to keep your backups forever.
    max-days: 7
portlek commented 3 years ago

how did the first file look like?

Osiris-Team commented 3 years ago

@portlek Nevermind, I created my own YAML Java-API in 10 days because these random comment errors made me go brrrrrrrrrrrrr.

Carleslc commented 2 years ago

Comments have been improved in the latest version. Probably this should be now fixed. If someone arrives to this issue please upgrade here. If the problem still persists open a new issue.

Osiris-Team commented 2 years ago

Oh dammn thats great! Sadly since then I had to create my own api even though I liked simple yaml a lot :/ Would like to hear what you think about it @Carleslc https://github.com/Osiris-Team/Dyml

Carleslc commented 2 years ago

Oh dammn thats great! Sadly since then I had to create my own api even though I liked simple yaml a lot :/ Would like to hear what you think about it @Carleslc https://github.com/Osiris-Team/Dyml

Seems promising! I can see one goal of your API is to be fast, that's great. Seems interesting the concept of a YAML Database too, though I don't know if YAML fits for that use-case as the file's structure is not very optimized as in traditional databases. Maybe for small databases or prototyping can be a well fit.

Simple-YAML is more focused on file configurations than large data storage, so time performance is not the highest priority, while easy-of-use is, along with being powerful enough to handle different needs, for instance presentation details like formatting and comment handling.

If you liked Simple-YAML YamlFile with the latest version you can now provide your own YAML implementation using the setImplementation(YamlImplementation) method, providing an instance that implements YamlImplementation interface to load/dump YAML to/from a ConfigurationSection (current implementations are SimpleYamlImplementation for the YamlFile default impl. and SnakeYamlImplementation as an alternative and YamlConfiguration default impl.), so you could for instance use Dyml to handle the parsing / dumping of YAML implementing the YamlImplementation interface (inheriting YamlImplementationCommentable class might also be useful but is not required) with something like DymlImplementation (is an example) while using Simple-YAML for setting/getting values and get the best of both worlds. For that you would instantiate the YamlFile using the implementation constructor or using setImplementation method with an instance of DymlImplementation after creating the YamlFile object with another constructor.

Also, the Simple-Configuration module is independent of the file format, so it can be used along with your implementation without importing Simple-Yaml module and its dependencies while still using the ConfigurationSection interface like MemoryConfiguration or FileConfiguration classes, if YamlFile is not needed.

Osiris-Team commented 2 years ago

Ohh didn't know you could add different YAML parsers. Good stuff!