From 8482521a8bde56244e27a51d14e16f828caa70a9 Mon Sep 17 00:00:00 2001 From: Troy McConaghy Date: Tue, 21 Nov 2017 14:10:14 +0100 Subject: [PATCH 1/4] Renamed all transaction schema files: added _v1.0 in them --- .../{transaction_create.yaml => transaction_create_v1.0.yaml} | 0 .../{transaction_transfer.yaml => transaction_transfer_v1.0.yaml} | 0 .../common/schema/{transaction.yaml => transaction_v1.0.yaml} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename bigchaindb/common/schema/{transaction_create.yaml => transaction_create_v1.0.yaml} (100%) rename bigchaindb/common/schema/{transaction_transfer.yaml => transaction_transfer_v1.0.yaml} (100%) rename bigchaindb/common/schema/{transaction.yaml => transaction_v1.0.yaml} (100%) diff --git a/bigchaindb/common/schema/transaction_create.yaml b/bigchaindb/common/schema/transaction_create_v1.0.yaml similarity index 100% rename from bigchaindb/common/schema/transaction_create.yaml rename to bigchaindb/common/schema/transaction_create_v1.0.yaml diff --git a/bigchaindb/common/schema/transaction_transfer.yaml b/bigchaindb/common/schema/transaction_transfer_v1.0.yaml similarity index 100% rename from bigchaindb/common/schema/transaction_transfer.yaml rename to bigchaindb/common/schema/transaction_transfer_v1.0.yaml diff --git a/bigchaindb/common/schema/transaction.yaml b/bigchaindb/common/schema/transaction_v1.0.yaml similarity index 100% rename from bigchaindb/common/schema/transaction.yaml rename to bigchaindb/common/schema/transaction_v1.0.yaml From 35fa8d7d194004018408368471817010faa158b9 Mon Sep 17 00:00:00 2001 From: Troy McConaghy Date: Tue, 21 Nov 2017 14:12:13 +0100 Subject: [PATCH 2/4] Updated all code/docs referencing the transaction schema files by name --- bigchaindb/common/schema/__init__.py | 10 +++++--- .../source/appendices/tx-yaml-files.rst | 25 ++++++++----------- .../source/data-models/transaction-model.rst | 7 +++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/bigchaindb/common/schema/__init__.py b/bigchaindb/common/schema/__init__.py index b2e8129a..ab13cac3 100644 --- a/bigchaindb/common/schema/__init__.py +++ b/bigchaindb/common/schema/__init__.py @@ -21,10 +21,14 @@ def _load_schema(name): fast_schema = rapidjson_schema.loads(rapidjson.dumps(schema)) return path, (schema, fast_schema) +TX_SCHEMA_VERSION = 'v1.0' -TX_SCHEMA_PATH, TX_SCHEMA_COMMON = _load_schema('transaction') -_, TX_SCHEMA_CREATE = _load_schema('transaction_create') -_, TX_SCHEMA_TRANSFER = _load_schema('transaction_transfer') +TX_SCHEMA_PATH, TX_SCHEMA_COMMON = _load_schema('transaction_' + + TX_SCHEMA_VERSION) +_, TX_SCHEMA_CREATE = _load_schema('transaction_create_' + + TX_SCHEMA_VERSION) +_, TX_SCHEMA_TRANSFER = _load_schema('transaction_transfer_' + + TX_SCHEMA_VERSION) VOTE_SCHEMA_PATH, VOTE_SCHEMA = _load_schema('vote') diff --git a/docs/server/source/appendices/tx-yaml-files.rst b/docs/server/source/appendices/tx-yaml-files.rst index f9a51685..64ac751c 100644 --- a/docs/server/source/appendices/tx-yaml-files.rst +++ b/docs/server/source/appendices/tx-yaml-files.rst @@ -2,11 +2,8 @@ The Transaction Schema Files ============================ BigchainDB checks all :ref:`transactions ` -(JSON documents) against a formal schema -defined in some JSON Schema files named -transaction.yaml, -transaction_create.yaml and -transaction_transfer.yaml. +against a formal schema +defined in some JSON Schema files. The contents of those files are copied below. To understand those contents (i.e. JSON Schema), check out @@ -16,22 +13,22 @@ by Michael Droettboom or `json-schema.org `_. -transaction.yaml ----------------- +transaction_v1.0.yaml +--------------------- -.. literalinclude:: ../../../../bigchaindb/common/schema/transaction.yaml +.. literalinclude:: ../../../../bigchaindb/common/schema/transaction_v1.0.yaml :language: yaml -transaction_create.yaml ------------------------ +transaction_create_v1.0.yaml +---------------------------- -.. literalinclude:: ../../../../bigchaindb/common/schema/transaction_create.yaml +.. literalinclude:: ../../../../bigchaindb/common/schema/transaction_create_v1.0.yaml :language: yaml -transaction_transfer.yaml -------------------------- +transaction_transfer_v1.0.yaml +------------------------------ -.. literalinclude:: ../../../../bigchaindb/common/schema/transaction_transfer.yaml +.. literalinclude:: ../../../../bigchaindb/common/schema/transaction_transfer_v1.0.yaml :language: yaml diff --git a/docs/server/source/data-models/transaction-model.rst b/docs/server/source/data-models/transaction-model.rst index 631399e2..2490a247 100644 --- a/docs/server/source/data-models/transaction-model.rst +++ b/docs/server/source/data-models/transaction-model.rst @@ -68,7 +68,6 @@ The Transaction Schema ---------------------- BigchainDB checks all transactions (JSON documents) -against a formal schema defined in :ref:`some JSON Schema files named -transaction.yaml, -transaction_create.yaml and -transaction_transfer.yaml `. +against a formal schema defined in :ref:`some JSON Schema files +(copied verbatim into the Appendices) +`. From 94c77ba658c1c6238e2a3d2bc8d6efa1b166c808 Mon Sep 17 00:00:00 2001 From: Troy McConaghy Date: Tue, 21 Nov 2017 14:13:24 +0100 Subject: [PATCH 3/4] Removed the line from transaction_v1.0.yaml --- bigchaindb/common/schema/transaction_v1.0.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/bigchaindb/common/schema/transaction_v1.0.yaml b/bigchaindb/common/schema/transaction_v1.0.yaml index 33f6a1f8..2d5a4964 100644 --- a/bigchaindb/common/schema/transaction_v1.0.yaml +++ b/bigchaindb/common/schema/transaction_v1.0.yaml @@ -1,6 +1,5 @@ --- "$schema": "http://json-schema.org/draft-04/schema#" -id: "http://www.bigchaindb.com/schema/transaction.json" type: object additionalProperties: false title: Transaction Schema From dfe072e443ed1be5fe3111244e9d13c11200c389 Mon Sep 17 00:00:00 2001 From: Troy McConaghy Date: Tue, 21 Nov 2017 14:52:15 +0100 Subject: [PATCH 4/4] Fixed a Flake8 error --- bigchaindb/common/schema/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bigchaindb/common/schema/__init__.py b/bigchaindb/common/schema/__init__.py index ab13cac3..f7f0aa80 100644 --- a/bigchaindb/common/schema/__init__.py +++ b/bigchaindb/common/schema/__init__.py @@ -21,6 +21,7 @@ def _load_schema(name): fast_schema = rapidjson_schema.loads(rapidjson.dumps(schema)) return path, (schema, fast_schema) + TX_SCHEMA_VERSION = 'v1.0' TX_SCHEMA_PATH, TX_SCHEMA_COMMON = _load_schema('transaction_' +