Files
numscript/v1.specs.schema.json
Alessandro ScandoneandGitHub e58c2c09e8 fix: properly version json schemas (#171)
* fix: update schemas

* fix: update the schema of new specs file generator

* fix: update specs $schema field to the new one
2026-07-10 10:49:32 +02:00

336 lines
9.3 KiB
JSON

{
"$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"
}
}
},
"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. Each value is a tagged value.",
"items": { "$ref": "#/definitions/SetAccountMetadataRow" }
},
"SetAccountMetadataRow": {
"type": "object",
"description": "A single set metadata entry: the tagged 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/Value"
},
"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 tagged value of a given key",
"additionalProperties": false,
"required": ["key", "value"],
"properties": {
"key": {
"type": "string"
},
"value": {
"$ref": "#/definitions/Value"
}
}
},
"Value": {
"type": "object",
"description": "A tagged value, discriminated by its \"type\"",
"oneOf": [
{
"additionalProperties": false,
"required": ["type", "value"],
"properties": {
"type": { "const": "string" },
"value": { "type": "string" }
}
},
{
"additionalProperties": false,
"required": ["type", "value"],
"properties": {
"type": { "const": "number" },
"value": { "type": "string", "pattern": "^-?[0-9]+$" }
}
},
{
"additionalProperties": false,
"required": ["type", "name"],
"properties": {
"type": { "const": "asset" },
"name": { "type": "string", "pattern": "^([A-Z]+(/[0-9]+)?)$" }
}
},
{
"additionalProperties": false,
"required": ["type", "name"],
"properties": {
"type": { "const": "account" },
"name": { "type": "string", "pattern": "^([a-zA-Z0-9_-]+(:[a-zA-Z0-9_-]+)*)$" },
"scope": { "type": "string", "pattern": "^[a-z0-9_]*$" }
}
},
{
"additionalProperties": false,
"required": ["type", "asset", "amount"],
"properties": {
"type": { "const": "monetary" },
"asset": { "type": "string", "pattern": "^([A-Z]+(/[0-9]+)?)$" },
"amount": { "type": "string", "pattern": "^-?[0-9]+$" }
}
},
{
"additionalProperties": false,
"required": ["type", "numerator", "denominator"],
"properties": {
"type": { "const": "portion" },
"numerator": { "type": "string", "pattern": "^-?[0-9]+$" },
"denominator": { "type": "string", "pattern": "^-?[0-9]+$" }
}
}
]
},
"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"]
}
}
}