docs: fix regex under the pattern keyword #1335
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
In 6 endpoints there is the following regex
'a-km-zA-HJ-NP-Z1-9{8,64}'
under thepattern
keyword. The regex intends to validate the user input for:blockId
parameter of theblock
related endpoints andaddress
parameter of thecontracts
endpointHowever, it is not working as expected hence is not allowing the user to input valid block heights or hashes.
Fix
In the
block
endpoints where theblockId
is either ablock height
or ablock hash
, the regex was replaced by the following pattern :This pattern should match either :
0x
or0X
and then its followed by 64 hexadecimal digits (0-9a-fA-F). This could work for theblock hash
.block height
.In the
contracts
endpoint, the pattern was removed.Note
The replaced pattern in the
blockId
captures a lot of wrong inputs. However, it does not work 100% as expected (for example it ignores completely the length limit). I think this is a swagger issue since there are some open issues related to regex patterns not working correctly :