Files
interpres/CHANGELOG.md
T

102 lines
4.4 KiB
Markdown
Raw Normal View History

# Changelog
All notable changes to **interpres** are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
2026-07-26 18:35:21 +02:00
## [1.1.1] — 2026-07-26
### Changed
- **Project**
- Migrate from Codeberg to sourcedock.dev (module path, imports, CI).
2026-06-26 20:12:15 +02:00
## [1.1.0] — 2026-06-26
Adds TOML emission to the previously read-only library, completing the
`encoding/json`-style API.
### Added
**Marshalling**
- `Marshal(v any) ([]byte, error)` — encode a struct or `map[string]V` value
to a TOML 1.0 document.
- `Encoder` and `NewEncoder`, mirroring the `Decoder` shape for symmetry with
`Unmarshal`.
- `Marshaler` interface (`MarshalTOML() (any, error)`) for types that need a
custom TOML shape; the returned value is encoded normally.
- Struct fields are matched by `toml:"name"` tag (case-insensitive fallback to
field name; `toml:"-"` skips). Anonymous (embedded) fields without a tag
are inlined.
- Slices and arrays of structs or maps become `[[a]]` arrays of tables; other
slices and arrays become TOML arrays. Empty or nil arrays of tables are
omitted; empty arrays of scalars emit as `key = []`.
- Scalars encode as bool, int64, float64, string, `time.Time` (offset
date-time), `LocalDateTime`, `LocalDate`, or `LocalTime`.
- `time.Time`, `LocalDateTime`, `LocalDate`, and `LocalTime` now have
`String()` methods that return their TOML-canonical rendering
(zero-padded to nanosecond precision when a fractional second is present).
**Encoding policy**
The emitter groups fields at every TOML level: scalars first, then
sub-tables, then arrays of tables. Within each group the order matches struct
field declaration order, or sorted key order for maps. The output is
guaranteed to re-parse to an equivalent value tree via `Parse`, but is not
byte-identical to any input that produced the value — comments, whitespace,
map key order, and basic-vs-literal string quoting are not preserved. See
the "Encoding" section of the README for the full set of rules.
## [1.0.0] — 2026-06-20
First stable release: a dependency-free TOML 1.0 parser for Go that uses only
the standard library and passes the entire
[toml-test](https://github.com/toml-lang/toml-test) suite
(**185 valid and 371 invalid cases, 0 failures**).
### Added
**Parsing**
- `Parse(data []byte) (map[string]any, error)` — decode a TOML document into an
untyped tree.
- Full TOML 1.0 syntax: comments; bare, quoted, and dotted keys; tables
(`[a.b]`) and arrays of tables (`[[a]]`); basic and literal strings, including
multiline (`"""` / `'''`) with escape sequences and line-ending backslash
trimming; integers in decimal, hex (`0x`), octal (`0o`), and binary (`0b`)
with `_` separators; floats with exponents and `inf` / `nan`; booleans;
offset/local date-times, dates, and times; arrays; and inline tables.
- Distinct date-time types: offset date-times decode to `time.Time`, while
`LocalDateTime`, `LocalDate`, and `LocalTime` represent the local variants.
- Strict, spec-conformant validation that rejects invalid documents: leading
zeros, misplaced underscores, malformed floats and radix literals, control
characters in strings and comments, bare carriage returns, non-UTF-8 input,
out-of-range Unicode escapes, multiline strings used as keys, single-digit
date-time components, duplicate/overwriting inline-table keys, and the full
family of table redefinitions (header vs. header, header vs. dotted key,
array of tables vs. table, and dotted-key appends to defined tables).
**Decoding**
- `Unmarshal(data []byte, v any)` — parse and map onto a struct or
`map[string]any` via reflection.
- `toml:"name"` field tags, case-insensitive name fallback, and `toml:"-"` to
skip a field.
- `Decoder` with `DisallowUnknownFields` for strict decoding that rejects keys
without a destination field.
- `SyntaxError` carrying the 1-based line of a malformed document.
**Project**
- Standard library only — zero third-party modules.
- `cmd/interpres-decode`, a toml-test harness adapter (TOML on stdin, tagged
JSON on stdout).
- A runnable example, a Go test suite, and a `just` task set (`install`, `run`,
`build`, `test`, `coverage`, `uninstall`).
2026-07-26 18:35:21 +02:00
[1.1.1]: https://sourcedock.dev/petrbalvin/interpres/releases/tag/v1.1.1
[1.1.0]: https://codeberg.org/petrbalvin/interpres/releases/tag/v1.1.0
[1.0.0]: https://codeberg.org/petrbalvin/interpres/releases/tag/v1.0.0