Plan
Plan copied to clipboard
Use Configurate or snakeyaml for yml parsing
I would like to be able to..
Split from #1363
Not use a custom yml parser (Leads to bugs #2297)
Is your feature request related to a problem? Please describe.
The previous ticket #1363 had unrelated stuff about moving to configurate in it. It is below
TODO
- Prepare for configurate
- Extract interface from Config and ConfigNode, (keep implementation with classes LegacyConfig and LegacyConfigNode)
- Extract interface from and rename ConfigReader and ConfigWriter to LegacyConfigReader and LegacyConfigWriter
- Write configurate based Config implementation
- Add configurate as a dependency, shadow and relocate it
- Implement ConfigNode and Config interfaces with configurate
- Move everything that extends LegacyConfig to use ConfigurateConfig
- Optional: If it is easier, change the configs to use composition instead of inheritance
- Implement ConfigReader and ConfigWriter and writer for configurate.
- Implement a ConfigReader and ConfigWriter that pass the read/write call to appropriate implementation
- eg: If ConfigurateConfigReader fails to read the yml (Because it is not valid yml), read with LegacyConfigReader so that the modifications mentioned above can be applied.
- eg: If Writer is passed a LegacyConfig it is written with LegacyConfigWriter
Acceptance criteria
At the end of this following classes should exist:
- Config (interface)
- ConfigNode (interface)
- ConfigWriter
- ConfigReader
- LegacyConfig
- LegacyConfigNode
- LegacyConfigWriter
- LegacyConfigReader
- ConfigurateConfig
- ConfigurateConfigNode
- ConfigurateConfigWriter
- ConfigurateConfigReader
- _____ConfigReader (the reader that calls other readers)
- _____ConfigWriter (the writer that calls other writers)
Validations:
- Plan can enable with an old config (I think there is an unit test for this)
- Old config is transformed during enable
- Transformed yml is valid yml
- Config does not lose comments when using configurate
- Plan can enable with a new config without using LegacyConfig
Config does not lose comments when using configurate
Won't be able to write files and have comments on yaml without https://github.com/SpongePowered/Configurate/pull/175