{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Specs", "type": "object", "additionalProperties": false, "required": ["testCases"], "properties": { "$schema": { "type": "string" }, "balances": { "$ref": "#/definitions/Balances" }, "variables": { "$ref": "#/definitions/VariablesMap" }, "metadata": { "$ref": "#/definitions/AccountsMetadata" }, "testCases": { "type": "array", "items": { "$ref": "#/definitions/TestCase" } }, "featureFlags": { "type": "array", "items": { "type": "string" } } }, "definitions": { "TestCase": { "type": "object", "required": ["it"], "additionalProperties": false, "properties": { "it": { "type": "string", "description": "Test case description" }, "focus": { "type": "boolean", "description": "Skip all the other tests. Just for debugging: it will result in an error exit code" }, "skip": { "type": "boolean", "description": "Skip this test. Just for debugging: it will result in an error exit code" }, "balances": { "$ref": "#/definitions/Balances" }, "variables": { "$ref": "#/definitions/VariablesMap" }, "metadata": { "$ref": "#/definitions/AccountsMetadata" }, "expect.postings": { "type": "array", "items": { "$ref": "#/definitions/Posting" } }, "expect.endBalances": { "$ref": "#/definitions/Balances" }, "expect.endBalances.include": { "$ref": "#/definitions/Balances" }, "expect.movements": { "$ref": "#/definitions/Movements" }, "expect.txMetadata": { "$ref": "#/definitions/TxMetadata" }, "expect.metadata": { "$ref": "#/definitions/SetAccountsMetadata" }, "expect.error.missingFunds": { "type": "boolean" }, "expect.error.negativeAmount": { "type": "boolean" } } }, "Balances": { "type": "array", "description": "List of account balances. The (account, asset, color, scope) tuple of each entry must be unique within the list.", "items": { "$ref": "#/definitions/BalanceRow" } }, "BalanceRow": { "type": "object", "description": "The balance of a given (account, asset, color, scope)", "additionalProperties": false, "required": ["account", "asset", "amount"], "properties": { "account": { "type": "string", "pattern": "^([a-zA-Z0-9_-]+(:[a-zA-Z0-9_-]+)*)$" }, "asset": { "type": "string", "pattern": "^([A-Z]+(/[0-9]+)?)$" }, "amount": { "type": "number" }, "color": { "type": "string", "pattern": "^[A-Z]*$" }, "scope": { "type": "string", "pattern": "^[a-z0-9_]*$" } } }, "VariablesMap": { "type": "object", "description": "Map of variable name to variable stringified value", "additionalProperties": false, "patternProperties": { "^[a-z_]+$": { "type": "string" } } }, "AccountsMetadata": { "type": "array", "description": "List of account metadata entries. The (account, key, scope) tuple of each entry must be unique within the list.", "items": { "$ref": "#/definitions/AccountMetadataRow" } }, "AccountMetadataRow": { "type": "object", "description": "A single input metadata entry: the (opaque, string) value of a given (account, key, scope)", "additionalProperties": false, "required": ["account", "key", "value"], "properties": { "account": { "type": "string", "pattern": "^([a-zA-Z0-9_-]+(:[a-zA-Z0-9_-]+)*)$" }, "key": { "type": "string" }, "value": { "type": "string" }, "scope": { "type": "string", "pattern": "^[a-z0-9_]*$" } } }, "SetAccountsMetadata": { "type": "array", "description": "List of account metadata entries set during execution. The (account, key, scope) tuple of each entry must be unique within the list.", "items": { "$ref": "#/definitions/SetAccountMetadataRow" } }, "SetAccountMetadataRow": { "type": "object", "description": "A single set metadata entry: the value of a given (account, key, scope)", "additionalProperties": false, "required": ["account", "key", "value"], "properties": { "account": { "type": "string", "pattern": "^([a-zA-Z0-9_-]+(:[a-zA-Z0-9_-]+)*)$" }, "key": { "type": "string" }, "value": { "$ref": "#/definitions/MetaValue" }, "scope": { "type": "string", "pattern": "^[a-z0-9_]*$" } } }, "TxMetadata": { "type": "array", "description": "List of transaction metadata entries set during execution. The key of each entry must be unique within the list.", "items": { "$ref": "#/definitions/TxMetadataRow" } }, "TxMetadataRow": { "type": "object", "description": "A single transaction metadata entry: the value of a given key", "additionalProperties": false, "required": ["key", "value"], "properties": { "key": { "type": "string" }, "value": { "$ref": "#/definitions/MetaValue" } } }, "MetaValue": { "type": "string", "description": "A metadata value, as rendered in source form: a string as-is (abc), an account as its bare name (alice), an asset (COIN, USD/2), a number (42, -7), a monetary (USD/2 100), or a portion (1/2). The format is untyped: values of different types that render alike are not distinguished." }, "Movements": { "type": "array", "description": "List of funds sent from an account to another. The (source, sourceScope, destination, destinationScope, asset, color) tuple of each entry must be unique within the list.", "items": { "$ref": "#/definitions/Movement" } }, "Movement": { "type": "object", "description": "The funds sent from an account to another for a given (asset, color)", "additionalProperties": false, "required": ["source", "destination", "asset", "amount"], "properties": { "source": { "type": "string", "pattern": "^([a-zA-Z0-9_-]+(:[a-zA-Z0-9_-]+)*)$" }, "sourceScope": { "type": "string", "pattern": "^[a-z0-9_]*$" }, "destination": { "type": "string", "pattern": "^([a-zA-Z0-9_-]+(:[a-zA-Z0-9_-]+)*)$" }, "destinationScope": { "type": "string", "pattern": "^[a-z0-9_]*$" }, "asset": { "type": "string", "pattern": "^([A-Z]+(/[0-9]+)?)$" }, "amount": { "type": "number" }, "color": { "type": "string", "pattern": "^[A-Z]*$" } } }, "Posting": { "type": "object", "properties": { "source": { "type": "string" }, "sourceScope": { "type": "string", "pattern": "^[a-z0-9_]*$" }, "destination": { "type": "string" }, "destinationScope": { "type": "string", "pattern": "^[a-z0-9_]*$" }, "asset": { "type": "string", "pattern": "^([A-Z]+(/[0-9]+)?)$" }, "amount": { "type": "number" }, "color": { "type": "string", "pattern": "^[A-Z]*$" } }, "required": ["source", "destination", "asset", "amount"] } } }