app.specs
Specs for the core data structures and function contracts in Phylo.
Defines specs for Newick tree nodes, positioned tree nodes, metadata structures, UI component props, and the shared app state context. These specs serve as living documentation and can be used for validation and generative testing.
Custom generators for recursive and domain-specific specs are registered separately in app.spec-generators (under src/dev/) so that test.check is not required on the production classpath. Load that namespace (via dev-preload or test requires) to enable s/gen, s/exercise, and stest/check.
Sections: 1. Utility functions (validate-spec!, get-allowed-keys) 2. Tree data structures (::tree-node, ::positioned-node) 3. Bounding rectangle / scale ticks 4. Metadata structures (::metadata-header, ::metadata-row) 5. Import result specs 6. App state context (all atoms + setters) 7. Component props 8. Function specs (fdefs for newick, csv, date, tree, scale, layout, color, import modules)
Dev integration: - app.dev-preload sets expound/printer and instruments all fdefs - app.spec-generators registers custom generators for key specs - defui-with-spec macro (in app.specs CLJ) injects dev-only prop validation into UIx components
atom-of
(atom-of inner-spec)defui-with-spec
macro
(defui-with-spec name [spec-map] & body)get-allowed-keys
(get-allowed-keys spec)Gets all allowed keys for a spec, including both required and optional.
validate-spec!
(validate-spec! value spec label)(validate-spec! value spec label {:keys [check-unexpected-keys?], :or {check-unexpected-keys? false}})Validates a value against a spec. Logs errors for invalid values and warnings for unexpected keys. Returns the value unchanged (for threading).
Options: - check-unexpected-keys? (default false) - warn about keys not in spec