A TOML alternative for nested configuration

TOML is explicit about types, which is why people like it. Nesting is where it gets awkward: every level is a dotted header, and a list of records is a run of [[arrays.of.tables]]. NOVA keeps the explicit types and writes nesting as indentation.

config.toml nesting by header
[[services]]
id = "auth"
port = 8080

[[services.volumes]]
path = "/data"

[[services]]
id = "api"
port = 3000
service 1
inside service 1
service 2
config.nova nesting by indentation
services:
  - id: auth
    port: 8080
    volumes:
      - path: /data
  - id: api
    port: 3000
service 1
inside service 1
service 2

Children are indented exactly two spaces. Any other indentation is an error, not a different structure. Block structure, spec §4.3

What changes

TopicTOMLNOVASpec
NestingDotted table headersIndentation, exactly two spaces per level§4.3
Lists of recordsArrays of tables, [[x]]Block lists, or a table with a row count§4.9
NullNone; leave the key outnull is a value, distinct from an absent field§2
Integers64-bit, with hex, octal, binary and _ separatorsExact and arbitrary size; decimal digits only§4.5
DatesOffset and local date-times, dates and timesTimestamps are instants; the offset is not kept§2.6
ValidationExternal toolsA built-in schema language§6

Migrating

Convert in either direction. Going back to TOML works when the root is a record and nothing is null; a list of records becomes an array of tables again.

nvf convert config.toml --to nova -o config.nova
nvf convert config.nova --to toml

An offset date-time becomes a timestamp. Local dates and times become strings, because NOVA has no local kinds. TOML mapping, spec §11.2

When to stay with TOML

  • Your tool reads TOML, such as Cargo or pyproject.toml. Keep TOML there.
  • Your configuration is flat. With one or two levels, TOML’s headers cost little, and nothing has to be indented.
  • You rely on local dates or times, such as an opening hour without a time zone. NOVA would read them as strings.

Questions

Does NOVA have inline tables?

Yes, as flow records: {id: auth, port: 8080}. Flow lists, tuples, sets and maps work the same way and may span lines inside the brackets.

Why go back to indentation?

Because it is fixed by the grammar. Children are indented exactly two spaces, tabs are not allowed in indentation, and anything else is an error.

Are bare words typed like in YAML?

No. A bare word is a string unless it is true, false, null or a strict number, so the explicitness you get from TOML stays.