-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from_xrpl
should not accept snake_case dict keys
#694
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the changelog
Co-authored-by: Mayukha Vadari <mvadari@ripple.com>
The integration and snippet tests are not reliable. I'm observing these errors: (Integration Test Python 3.8): Snippet test error: httpx.HTTPStatusError: |
Co-authored-by: Mayukha Vadari <mvadari@ripple.com>
@justinr1234 @khancode can you please review this at your convinience? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
# Note: BaseModel.from_xrpl and its overridden methods accept only camelCase or | ||
# PascalCase inputs (i.e. snake_case is not accepted) | ||
def test_from_xrpl_accepts_only_camel_case_inputs(self): | ||
request = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between this test case and tx_snake_case_keys
? Just want to make sure I'm following what's going on here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, both the tests dis-allow snake_case
keys in Request
and Transaction
models, respectively. I used different inputs for two different models
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you split it into 2 tests (2 functions)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 58ff257
I have updated the regular-expression which is used to invalidate inputs in If anyone has objections pertaining to it, please let me know. It is not related to the changelist of this PR. |
* BaseModel.from_xrpl method should not accept snake_case keys in dictionary input * Fix integration test: Update regex to accomodate Amount2 AMM field --------- Co-authored-by: Mayukha Vadari <mvadari@ripple.com>
BaseModel.from_xrpl
method should not accept snake_case keys in dictionary input.Fix #689 . You can find more context in the discussion pertaining to this issue.
I have used a regular expression matches for snake_case. If you have any other ideas for detecting
non-camelCase
input formats, let me know. There appears to be a variety of solutions for this problem, but all of them have slight differences in their behavior.High Level Overview of Change
Context of Change
Type of Change
Did you update CHANGELOG.md?
Do external users use
from_xrpl
method? I believe they usefrom_dict
(hasn't been modified) which internally makes a call tofrom_xrpl
Test Plan