Skip to main content

Module schema

Module schema 

Source
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§

AccountSpec
One account of the chart.
AssetSpec
A fixed asset registered before the first event (B-15).
BasisSpec
An asset’s basis facts (B-25).
BillSpec
A bill from vendor (B-38).
ChangeSpec
A change to the books that posts no entry, made right after event after once that event’s expectations are checked: exactly one of rename, require_tax_category and correct_asset.
CloseSpec
A close of the period from start through the event’s date (B-11, B-13).
CorrectSpec
A registered asset’s economics corrected for reason: each figure given replaces the asset’s; the rest stay.
DisposeSpec
A fixed asset’s disposal (B-15).
DocumentLineSpec
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.
FixedAsset
Accounts that hold property and equipment, for an example no asset’s own figures matter to.
InstrumentSpec
A payment method (B-19).
InvoiceSpec
An invoice to customer (B-38).
LineSpec
One line of an entry.
MemberSpec
One member of a multi-member LLC (B-13).
PartySpec
One party in the directory (B-26, B-35).
PayeeSpec
A payee marked for an information return from the beginning (B-19).
ProjectSpec
A project (B-37): its name, and its kind, status and party if given.
Query
The question an expectation asks: everything but the answer.
RenameSpec
Rename the account code to name (B-31).
RunSchedulesSpec
Every schedule’s months due through through (B-16).
RunSpec
A depreciation run of asset for period (YYYY-MM), dated at the month’s end (B-15).
ScheduleSpec
A prepaid expense or deferred revenue recognized over its months (B-16), in setup.schedules or registered by an event.
SchemaError
Why an example is not well formed.
Setup
The books an example sets up, before any event.
ShareSpec
A party named on an entry, with its share (B-35).
StatusChangeSpec
A payee’s 1099 decision from effective on (B-19, D-40).
WriteOffSpec
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§

EventKind
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-DD and 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).