Merge pull request #1518 from bigchaindb/require_asset_data

Require asset.data for CREATE and asset.id for TRANSFER in the schemas
This commit is contained in:
libscott 2017-06-08 13:22:04 +02:00 committed by GitHub
commit c9b5637681
3 changed files with 13 additions and 0 deletions

View File

@ -14,6 +14,8 @@ properties:
- type: object
additionalProperties: true
- type: 'null'
required:
- data
inputs:
type: array
title: "Transaction inputs"

View File

@ -12,6 +12,8 @@ properties:
"$ref": "#/definitions/sha3_hexdigest"
description: |
ID of the transaction that created the asset.
required:
- id
inputs:
type: array
title: "Transaction inputs"

View File

@ -101,6 +101,15 @@ def test_create_tx_asset_type(create_tx):
validate_raises(create_tx)
def test_create_tx_no_asset_data(create_tx):
tx_body = create_tx.to_dict()
del tx_body['asset']['data']
tx_body_no_signatures = Transaction._remove_signatures(tx_body)
tx_body_serialized = Transaction._to_str(tx_body_no_signatures)
tx_body['id'] = Transaction._to_hash(tx_body_serialized)
validate_raises(tx_body)
################################################################################
# Inputs