Fix regex validation on numeric inputs (#1731)

* Fix regex validation on numeric inputs
This commit is contained in:
Michael Huang
2019-03-25 14:18:58 -05:00
committed by F. Eugene Aumson
parent 7010b1adb9
commit e043735362
2 changed files with 23 additions and 12 deletions

View File

@@ -0,0 +1,11 @@
[
{
"timestamp": 1553491629,
"version": "1.0.1",
"changes": [
{
"note": "Fix regex validation on numeric values"
}
]
}
]

View File

@@ -185,10 +185,10 @@ class OrderSchema(object):
"Invalid value for `maker_fee`, must not be `None`"
) # noqa: E501
if maker_fee is not None and not re.search(
r"^\\d+$", maker_fee
r"^\d+$", maker_fee
): # noqa: E501
raise ValueError(
r"Invalid value for `maker_fee`, must be a follow pattern or equal to `/^\\d+$/`"
r"Invalid value for `maker_fee`, must be a follow pattern or equal to `/^\d+$/`"
) # noqa: E501
self._maker_fee = maker_fee
@@ -216,10 +216,10 @@ class OrderSchema(object):
"Invalid value for `taker_fee`, must not be `None`"
) # noqa: E501
if taker_fee is not None and not re.search(
r"^\\d+$", taker_fee
r"^\d+$", taker_fee
): # noqa: E501
raise ValueError(
r"Invalid value for `taker_fee`, must be a follow pattern or equal to `/^\\d+$/`"
r"Invalid value for `taker_fee`, must be a follow pattern or equal to `/^\d+$/`"
) # noqa: E501
self._taker_fee = taker_fee
@@ -278,10 +278,10 @@ class OrderSchema(object):
"Invalid value for `maker_asset_amount`, must not be `None`"
) # noqa: E501
if maker_asset_amount is not None and not re.search(
r"^\\d+$", maker_asset_amount
r"^\d+$", maker_asset_amount
): # noqa: E501
raise ValueError(
r"Invalid value for `maker_asset_amount`, must be a follow pattern or equal to `/^\\d+$/`"
r"Invalid value for `maker_asset_amount`, must be a follow pattern or equal to `/^\d+$/`"
) # noqa: E501
self._maker_asset_amount = maker_asset_amount
@@ -309,10 +309,10 @@ class OrderSchema(object):
"Invalid value for `taker_asset_amount`, must not be `None`"
) # noqa: E501
if taker_asset_amount is not None and not re.search(
r"^\\d+$", taker_asset_amount
r"^\d+$", taker_asset_amount
): # noqa: E501
raise ValueError(
r"Invalid value for `taker_asset_amount`, must be a follow pattern or equal to `/^\\d+$/`"
r"Invalid value for `taker_asset_amount`, must be a follow pattern or equal to `/^\d+$/`"
) # noqa: E501
self._taker_asset_amount = taker_asset_amount
@@ -401,9 +401,9 @@ class OrderSchema(object):
raise ValueError(
"Invalid value for `salt`, must not be `None`"
) # noqa: E501
if salt is not None and not re.search(r"^\\d+$", salt): # noqa: E501
if salt is not None and not re.search(r"^\d+$", salt): # noqa: E501
raise ValueError(
r"Invalid value for `salt`, must be a follow pattern or equal to `/^\\d+$/`"
r"Invalid value for `salt`, must be a follow pattern or equal to `/^\d+$/`"
) # noqa: E501
self._salt = salt
@@ -493,10 +493,10 @@ class OrderSchema(object):
"Invalid value for `expiration_time_seconds`, must not be `None`"
) # noqa: E501
if expiration_time_seconds is not None and not re.search(
r"^\\d+$", expiration_time_seconds
r"^\d+$", expiration_time_seconds
): # noqa: E501
raise ValueError(
r"Invalid value for `expiration_time_seconds`, must be a follow pattern or equal to `/^\\d+$/`"
r"Invalid value for `expiration_time_seconds`, must be a follow pattern or equal to `/^\d+$/`"
) # noqa: E501
self._expiration_time_seconds = expiration_time_seconds