attribute assert nesting
This commit is contained in:
parent
07b6fa080d
commit
ab5500dfda
1 changed files with 2 additions and 2 deletions
|
@ -81,7 +81,7 @@ List of possible asserts are:
|
|||
| `lt, le, gt, ge` | `comparative` | stateless |
|
||||
| `limit` | [`max_cumsum`, `interval_in_sec`] | [`current_cumsum`, `interval_began`] |
|
||||
| `limit_monthly` | [`max_cumsum`, `interval_in_months`] | [`current_cumsum`, `interval_began`] |
|
||||
| `attribute_assert` | `attribute_to_assert` = [{`attribute_identifier`: `any of above assert_objects`}] | stateless |
|
||||
| `attribute_assert` | `attribute_to_assert` = [{`attribute_identifier`: `any assert_objects`}] | stateless |
|
||||
|
||||
There is no implicit type conversion when attempting to assert, incompatible type means assert failure. If required, a field can be added that stores the assumed type of the argument (if conversion fails, assert fails). If an argument has no asset, it is unrestricted and may be given (or not for optional arguments) with any value.
|
||||
|
||||
|
@ -114,7 +114,7 @@ The assert that needs to pass is now `current_cumsum + incoming value <= max_cum
|
|||
Statefull assert, only `int` type arguments. Analogue to `limit`, but `interval_began` is initially set to `month(valid_from)` and set to `month(now)` on update, additionally the time assert is `month(now) >= interval_began + interval_in_months` (include logic for month overflow when year changes).
|
||||
|
||||
#### `attribute_assert`
|
||||
Stateless assert, only for dictionary type objects. The `attribute_to_assert` list contains mappings between attributes and asserts that they must fulfill, if present in the dictionary.
|
||||
Stateless assert, only for dictionary type objects. The `attribute_to_assert` list contains mappings between attributes and asserts that they must fulfill, if present in the dictionary. Allows nesting of `attribute_assert`.
|
||||
|
||||
Note:
|
||||
- Assume `asset_update_operation`. All attributes of its `options` must be filled on update call. This assert can not be used to realize a "may only change attribute xzy of `options`". This would require that the logic knows which of the arguments are reflected on-chain and it knows how to query it for every operation that contains `options`. If `options` are to be restricted with this assert, all values that should not change would need be fixated by defining a `any` assert for those attributes, while having e.g. a `lt` assert for the one attribute that is allowed to change.
|
||||
|
|
Loading…
Reference in a new issue