test

command
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Command test is a self-contained yedit example that exercises every schema pattern and known edge case.

Run from the yedit root:

go run ./examples/test

A test.yaml file is created in the working directory on first run and reused on subsequent runs so you can see undo/save/validate in action.

Patterns demonstrated

Pattern 1 — (no fields) + YAML pane
  KindPrimitive    : app-name, debug, version, port
  KindDictionary   : labels, settings
  KindList         : tags, ports          ([]string / []int, no child defs)
  KindVariant      : timeout              (implements schema.Provider)

Pattern 2 — ADDED/AVAILABLE struct tree
  server      : flat struct          (host, port, tls)
  database    : nested struct        (driver, dsn, pool.min-size, pool.max-size)
  logging     : simple scalars       (level, file, show-caller)

Pattern 3 — [N] sequence navigator
  workers     : []Worker             (name, concurrency, queue, tags []string)
  routes      : []Route              (path, method oneof, handler, auth)

Edge cases demonstrated

[]string inside KindObject           → server.allowed-ips (leaf, no sub-tree)
map[string]string inside KindObject  → server.headers     (leaf, no sub-tree)
[]string inside a seq-item struct    → workers[N].tags    (leaf, no sub-tree)
KindDictionary at top level          → labels, settings
KindVariant (Provider)               → timeout            → (no fields) + YAML pane
KindEnum (oneof)                     → database.driver, route.method, logging.level
Deep nesting (3 levels)              → database.pool.*
required + MutuallyExclusive         → validators wired via editor.Config
Unknown YAML key in seed file        → "unknown-key" flagged by ctrl+l

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL