From 82cd3a61eded2257895a53f7ed1e5de8ca04dd7c Mon Sep 17 00:00:00 2001 From: muawiakh Date: Wed, 22 Nov 2017 18:31:35 +0100 Subject: [PATCH 1/4] Add metadata endpoint to info view - Metadata search was recently added and works seamlessly - The endpoint was not reflected in the info view i.e. when someone queries at root / or api/v1 endpoints. - Handle unit tests for the change as well. --- bigchaindb/web/views/info.py | 3 ++- tests/web/test_info.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bigchaindb/web/views/info.py b/bigchaindb/web/views/info.py index d6240bdb..810eb9c5 100644 --- a/bigchaindb/web/views/info.py +++ b/bigchaindb/web/views/info.py @@ -50,5 +50,6 @@ def get_api_v1_info(api_prefix): 'statuses': '{}statuses/'.format(api_prefix), 'assets': '{}assets/'.format(api_prefix), 'outputs': '{}outputs/'.format(api_prefix), - 'streams': websocket_root + 'streams': websocket_root, + 'metadata': '{}metadata/'.format(api_prefix), } diff --git a/tests/web/test_info.py b/tests/web/test_info.py index ce68b912..c0728485 100644 --- a/tests/web/test_info.py +++ b/tests/web/test_info.py @@ -18,6 +18,7 @@ def test_api_root_endpoint(client, wsserver_base_url): 'outputs': '/api/v1/outputs/', 'streams': '{}/api/v1/streams/valid_transactions'.format( wsserver_base_url), + "metadata": "/api/v1/metadata/" } }, 'docs': 'https://docs.bigchaindb.com/projects/server/en/vtsttst/', @@ -41,6 +42,7 @@ def test_api_v1_endpoint(client, wsserver_base_url): 'outputs': '/outputs/', 'streams': '{}/api/v1/streams/valid_transactions'.format( wsserver_base_url), + "metadata": "/metadata/" } res = client.get('/api/v1') assert res.json == api_v1_info From 5abb6ead8b7847979bc6f69b4971142aea821469 Mon Sep 17 00:00:00 2001 From: kansi Date: Thu, 23 Nov 2017 10:41:58 +0530 Subject: [PATCH 2/4] Update metadata documentation --- docs/server/source/data-models/transaction-model.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/server/source/data-models/transaction-model.rst b/docs/server/source/data-models/transaction-model.rst index 2490a247..16dd4510 100644 --- a/docs/server/source/data-models/transaction-model.rst +++ b/docs/server/source/data-models/transaction-model.rst @@ -48,6 +48,7 @@ Here's some explanation of the contents: to all (including nested) keys of the ``"data"`` JSON document: 1) keys (i.e. key names, not values) must **not** begin with the ``$`` character, and 2) keys must not contain ``.`` or the null character (Unicode code point 0000). + 3) The key `"language"` (at any level in the hierarchy) is a special key and used for specifying text search language. Its value must be one of the allowed values; see the valid [Text Search Languages](https://docs.mongodb.com/manual/reference/text-search-languages/) in the MongoDB Docs. In BigchainDB, only the languages supported by *MongoDB community edition* are allowed. **How the transaction ID is computed.** 1) Build a Python dictionary containing ``version``, ``inputs``, ``outputs``, ``operation``, ``asset``, ``metadata`` and their values, From b184e83b6a0270f28dc2ab5d1235b23234fc53fa Mon Sep 17 00:00:00 2001 From: muawiakh Date: Thu, 23 Nov 2017 10:24:35 +0100 Subject: [PATCH 3/4] [Doc]: Fix markdown formatting in rst --- docs/server/source/data-models/transaction-model.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/server/source/data-models/transaction-model.rst b/docs/server/source/data-models/transaction-model.rst index 16dd4510..3e2762b6 100644 --- a/docs/server/source/data-models/transaction-model.rst +++ b/docs/server/source/data-models/transaction-model.rst @@ -48,7 +48,7 @@ Here's some explanation of the contents: to all (including nested) keys of the ``"data"`` JSON document: 1) keys (i.e. key names, not values) must **not** begin with the ``$`` character, and 2) keys must not contain ``.`` or the null character (Unicode code point 0000). - 3) The key `"language"` (at any level in the hierarchy) is a special key and used for specifying text search language. Its value must be one of the allowed values; see the valid [Text Search Languages](https://docs.mongodb.com/manual/reference/text-search-languages/) in the MongoDB Docs. In BigchainDB, only the languages supported by *MongoDB community edition* are allowed. + 3) The key `"language"` (at any level in the hierarchy) is a special key and used for specifying text search language. Its value must be one of the allowed values; see the valid `Text Search Languages `_ in the MongoDB Docs. In BigchainDB, only the languages supported by *MongoDB community edition* are allowed. **How the transaction ID is computed.** 1) Build a Python dictionary containing ``version``, ``inputs``, ``outputs``, ``operation``, ``asset``, ``metadata`` and their values, From 020b6c1ff8c6ec1b9e08fd4ddbb802d083f2c354 Mon Sep 17 00:00:00 2001 From: muawiakh Date: Thu, 23 Nov 2017 10:43:48 +0100 Subject: [PATCH 4/4] Minor change in docs --- docs/server/source/data-models/transaction-model.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/server/source/data-models/transaction-model.rst b/docs/server/source/data-models/transaction-model.rst index 3e2762b6..59f0357f 100644 --- a/docs/server/source/data-models/transaction-model.rst +++ b/docs/server/source/data-models/transaction-model.rst @@ -45,7 +45,7 @@ Here's some explanation of the contents: - **metadata**: User-provided transaction metadata. It can be any valid JSON document, or ``null``. **NOTE:** When using MongoDB for storage, certain restriction apply - to all (including nested) keys of the ``"data"`` JSON document: + to all (including nested) keys of the JSON document: 1) keys (i.e. key names, not values) must **not** begin with the ``$`` character, and 2) keys must not contain ``.`` or the null character (Unicode code point 0000). 3) The key `"language"` (at any level in the hierarchy) is a special key and used for specifying text search language. Its value must be one of the allowed values; see the valid `Text Search Languages `_ in the MongoDB Docs. In BigchainDB, only the languages supported by *MongoDB community edition* are allowed.