Expand description
The shape of a bookspec example: the TOML schema, the parser, and the rules a well-formed example follows whatever engine runs it.
One file per example, named for its id (bookspec/README.md gives the
shape in prose; this module is its executable form). Every structure
refuses a key it does not know (deny_unknown_fields): a typo is an
error, never silently ignored. Example::from_toml parses and then
checks the shape; an engine’s own adapter only has to execute it.
Structs§
- Account
Spec - One account of the chart.
- Asset
Spec - A fixed asset registered before the first event (B-15).
- Basis
Spec - An asset’s basis facts (B-25).
- Bill
Spec - A bill from
vendor(B-38). - Change
Spec - A change to the books that posts no entry, made right after event
afteronce that event’s expectations are checked: exactly one ofrename,require_tax_categoryandcorrect_asset. - Close
Spec - A close of the period from
startthrough the event’s date (B-11, B-13). - Correct
Spec - A registered asset’s economics corrected for
reason: each figure given replaces the asset’s; the rest stay. - Dispose
Spec - A fixed asset’s disposal (B-15).
- Document
Line Spec - One line of an invoice or a bill.
- Event
- One event: an entry, a reversal, a close, a bill, an invoice, a command that posts what is due, or a schedule’s registration.
- Example
- One bookspec example: a setup, its events and changes, and what it expects of the books.
- Expect
- One expectation: a query, the dates or things it asks about, and what it expects.
- Fixed
Asset - Accounts that hold property and equipment, for an example no asset’s own figures matter to.
- Instrument
Spec - A payment method (B-19).
- Invoice
Spec - An invoice to
customer(B-38). - Line
Spec - One line of an entry.
- Member
Spec - One member of a multi-member LLC (B-13).
- Party
Spec - One party in the directory (B-26, B-35).
- Payee
Spec - A payee marked for an information return from the beginning (B-19).
- Project
Spec - A project (B-37): its name, and its kind, status and party if given.
- Query
- The question an expectation asks: everything but the answer.
- Rename
Spec - Rename the account
codetoname(B-31). - RunSchedules
Spec - Every schedule’s months due through
through(B-16). - RunSpec
- A depreciation run of
assetforperiod(YYYY-MM), dated at the month’s end (B-15). - Schedule
Spec - A prepaid expense or deferred revenue recognized over its months
(B-16), in
setup.schedulesor registered by an event. - Schema
Error - Why an example is not well formed.
- Setup
- The books an example sets up, before any event.
- Share
Spec - A party named on an entry, with its share (B-35).
- Status
Change Spec - A payee’s 1099 decision from
effectiveon (B-19, D-40). - Write
OffSpec - A write-off of the invoice an earlier event posted (rules.md B-41; plan P4b S7): the invoice’s event, what to write off and why.
Enums§
- Event
Kind - The kind of an event.
- Values
- What a query expects: figures by key (every figure an exact decimal string), or, for a file format, its lines or its rows of fields.
Constants§
- COMMANDS
- The commands an example may try: each on a copy of the books, so it changes nothing checked after it.
- COMPLETE_
QUERIES - The queries whose example lists every value it covers, so a value left
out of an example is an error. The others name the figures they show:
cash_flow, the statements, the register, a schedule’s plan and an asset’s basis. - EXEMPT_
REASONS - Why a party is not reportable (B-19).
- FORMAT_
QUERIES - The formats appendix’s queries.
- QUERIES
- The queries every engine must answer: the figure queries first, then the calendar ones, then the commands (tried on a copy of the books), then the formats appendix’s.
- ROLES
- The party roles the specification names.
- TEXT_
VALUED - The queries whose figures may be text rather than an exact decimal
string: a status, a direction, a date, a year, a name, a rule name,
"none","open","true"or"false", and the register’s dates beside its figures.
Functions§
- is_date
- A date,
YYYY-MM-DDand a real day. - is_
exact_ decimal - An exact decimal string: digits, an optional sign and point; never an exponent, never a float.
- is_
month - A month,
YYYY-MM. - refusal_
reasons - Every refusal reason the specification names (bookspec/README.md), each
the reason of exactly one rule (see
crate::rules::rule_for_refusal).