pain001.schemas package#

Bundled JSON validation schemas for pain001 message types.

Submodules#

pain001.schemas.required_columns module#

The one place that says which columns a payment row must carry.

Until 0.0.67 four hand-typed lists answered that question and disagreed: a 22-column dict in the CSV validator, a 12-column dict in the SQLite validator, a 7-column set in the editor diagnostics and the per-version required lists in the bundled JSON schemas. A column added to one was silently absent from the others.

The bundled schemas (pain001/schemas/<type>.schema.json) are the source now. required_columns() returns, for a message type, that schema’s required list typed from its properties; with no message type it returns every column all bundled schemas describe, which is the 22-column contract the CSV and SQLite validators always enforced when they could not know the target version.

Types map as the validators check them: JSON integer to int, number to float, boolean to bool, a string with a date or date-time format to datetime.datetime, and anything else to str.

pain001.schemas.required_columns.python_type(spec: dict[str, Any]) → type[source]#

Map one JSON-schema property to the type the validators check.

Parameters:

spec – The property’s schema fragment (type, format …).

Returns:

int, float, bool, datetime or str.

pain001.schemas.required_columns.required_columns(message_type: str | None = None) → dict[str, type][source]#

Return the columns a row must carry, with the type each must hold.

Parameters:

message_type – A bundled message type such as pain.001.001.09. None means the target version is not known, in which case every column all bundled schemas describe is required.

Returns:

A fresh {column: type} dict, in schema order, safe to mutate.

Raises:

ValueError – If message_type is not a bundled message type.