Configuration guides

Locate a repeated TOML key and check version compatibility

·

Use a short case to separate a TOML grammar problem from an application configuration problem. Check the selected version, diagnosis and source position together.

TOML Validator

Find the repeated key on line 2

Enter port = 443 on the first line and port = 444 on the second. Validate and expect a diagnostic at line 2, column 1. Go to error selects the start of the second key.

Rename the second key to fallback_port and validate again. The report counts two root entries. If both values were meant for one setting, enter a single port value or use the shape your application expects.

TOML keys and duplicate definitions

Compare 07:30 under both supported versions

Replace the input with maintenance = 07:30. TOML 1.1 accepts it and counts one date/time value in the report. TOML 1.0 compatibility reports line 1, column 15 and requires seconds.

Change the value to 07:30:00 to pass either version. Select the version your receiving program supports, then save the report if you need a record of the check.

TOML 1.1 release changesTOML 1.1 local time

Check the calendar date independently of the version

Try due = 1900-02-29. It reports a calendar error at line 1, column 7 in either version. The year 1900 was divisible by 100 but not by 400.

Use due = 2000-02-29 to check the leap-year case. After a syntax pass, compare the key names and values with your application’s configuration documentation.

TOML local dateRFC 3339 calendar restrictions

Common questions

Can I use the same key in different tables?

Yes. Keys are unique within each table. The two name keys in the sample are in different items of the route array.

Which diagnostics does the tool show?

The first failed check includes a message, a line number and a column. Correct it and run the validator again to check the next issue.

Sources

Put it into practice.

Related guides