Require every choice variant to carry a path, and list only what Fake accepts

This commit is contained in:
lilleman
2026-08-27 23:07:03 +02:00
committed by lilleman-tw
parent 7d5d03e393
commit af5b8c9abd
3 changed files with 90 additions and 35 deletions
+6 -2
View File
@@ -141,7 +141,8 @@ av == bv // true
```
`f.List()` returns the sorted paths the loaded data offers — the categories, their
dotted fields and folder segments (what the CLI's `-list` prints).
dotted fields and folder segments (what the CLI's `-list` prints). It is exactly the
set `Fake` accepts.
A `*Fakes` is **not** safe for concurrent use — create one per goroutine.
@@ -362,7 +363,10 @@ no tokens at all, use a bare string node (`"100 Main St"`), emitted verbatim.
This yields e.g. `Anna Eriksson`, `Erik Berg`, or rarely `dr Astrid von Flemming`.
Any field is reachable by dotted path — `Fake("person.last")` renders just a
surname; choices along the path are resolved at random.
surname; choices along the path are resolved at random. A path may continue
*through* a choice only where every variant carries the rest of it (so
`currency.symbol` works across all 16 currency variants), which keeps a path from
rendering on one call and failing on the next.
### Performance