Skip to content

The YAML and DYML processor of your dreams, with ultimate comment support, written from scratch in Java!

License

Notifications You must be signed in to change notification settings

Osiris-Team/Dyml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dyml

The YAML and DYML processor of your dreams, with ultimate comment support, written from scratch in Java!

Features

  • Amazing support for side, multiline, regular comments and line breaks.
  • Written from scratch with performance and usability in mind.
  • Only key-features of YAML implemented, thus very small, blazing fast and easy to use.
  • API design, core ideas:
    • Rely on default values
    • Either null or nothing (no empty values/strings)
    • Keep it simple but powerful (few objects that can do a lot)

example.yml code

important: Everything else that is not explicitly mentioned in this file is not supported

# Comments and
# multiline comments support.
supports-lists: 
  - Hello World!
  - 2nd value
supports-hyphen-separation: awesome! 
or separation by spaces: great! # side-comments supported!
and.dots.like.this: wow!
or:even:colons: puh!

# Complex hierarchies supported.
g0:
  g1a:
    g2a: wow!
    g2b: <3
  g1b:
    - v1 # side-comments in lists
    # This is also a side-comment, for the value below
    - v2

example.dyml code

important Everything else that is not explicitly mentioned in this file is not supported
 Comments and
 multiline comments support.
key value
 Complex hierarchies supported.
g0
  g1a
    g2a wow!
    g2b <3
  g1b great!

Read more about the .dyml file type here. Note that the API for .dyml files is in beta and not all features of the .yaml API were ported over yet.

Some extras:

  • DirWatcher | Directory watcher with recursive directory watching support.
  • YamlDatabase | (BETA) Yaml based, lightning fast database.

Examples

All examples can be found as tests here.

Show frequent YAML mistakes

It's fine to have colons in keys, as long as there is no space after it. Here is a small quiz, determine the key and value for the following yaml section:

hello:there: my : friend: !

Answer: The key is hello:there and the value my : friend: !.

Benchmarks

Dream-Yaml seems to be about 9x faster than SnakeYAML , 8x faster than YamlBeans , 4x faster than eo-yaml and 3x faster than Simple-Yaml.

Open/close details

FAQ

Difference between 'loaded' and 'added' modules? The only difference, is that loaded modules cannot have default values set. They are basically the raw output from your yaml file. In-Edit modules get created when you call the add() method. Their initial value is taken from the loaded module with the same keys.
How are null/empty values handled?
parent:
  key1:               # this value is null
  key2: ~             # not null, but a string
  key3: null          # not null, but a string
  key5: "null"        # not null, but a string
  key5: ""            # this value is null (note that if you disable the remove quotes post-processing option, this is a string("") and not empty, otherwise this gets turned into a null value)
To sum it up: Empty values do NOT exist. Null values exist. Note that null values are removed from the modules values list, in the post-processing part while parsing the yaml file. You can disable it though, if you want.
Fallback to default values? When the 'real value' is null, return the default value. This feature is enabled by default. You can change it for each individual module.

About

The YAML and DYML processor of your dreams, with ultimate comment support, written from scratch in Java!

Topics

Resources

License

Stars

Watchers

Forks

Languages