-
Notifications
You must be signed in to change notification settings - Fork 3
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
Model validation #39
Open
CreatureDev
wants to merge
14
commits into
main
Choose a base branch
from
pr/model-validation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Model validation #39
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f4d4f1b
account validation
CreatureDev 294baa6
admin validation
CreatureDev f3c5352
improve error
CreatureDev 651a7e4
channel validation
CreatureDev ec0b614
clio validation
CreatureDev efbcd0d
ledger request validation
CreatureDev 1480b93
path/book validation
CreatureDev 435b6c8
server request validation
CreatureDev 4e762f2
subscribe validation
CreatureDev b762889
transactions validation
CreatureDev 5c5a725
utility validation
CreatureDev 22d44cb
addl tests
CreatureDev d8364f0
typo
CreatureDev 7c9fd4f
requested changes
CreatureDev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package account | |
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/xyield/xrpl-go/model/client/common" | ||
"github.com/xyield/xrpl-go/model/transactions/types" | ||
|
@@ -20,6 +21,23 @@ func (*AccountLinesRequest) Method() string { | |
return "account_lines" | ||
} | ||
|
||
func (r *AccountLinesRequest) Validate() error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to also run the account.Validate on the 'peer' parameter if it is present |
||
if err := r.Account.Validate(); err != nil { | ||
return fmt.Errorf("account lines request account: %w", err) | ||
} | ||
|
||
if r.Limit != 0 && (r.Limit < 10 || r.Limit > 400) { | ||
return fmt.Errorf("account lines request: invalid limit, must be 10 <= limit <= 400") | ||
} | ||
|
||
if r.Peer != "" { | ||
if err := r.Peer.Validate(); err != nil { | ||
return fmt.Errorf("account lines request peer: %w", err) | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
func (r *AccountLinesRequest) UnmarshalJSON(data []byte) error { | ||
type alrHelper struct { | ||
Account types.Address `json:"account"` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
package data | ||
|
||
const ( | ||
Fatal LogSeverity = "fatal" | ||
Error LogSeverity = "error" | ||
Warn LogSeverity = "warn" | ||
Info LogSeverity = "info" | ||
Debug LogSeverity = "debug" | ||
Trace LogSeverity = "trace" | ||
) | ||
|
||
type LogSeverity string | ||
|
||
type LogLevelRequest struct { | ||
Severity string `json:"severity,omitempty"` | ||
Partition string `json:"partition,omitempty"` | ||
Severity LogSeverity `json:"severity,omitempty"` | ||
Partition string `json:"partition,omitempty"` | ||
} | ||
|
||
func (*LogLevelRequest) Method() string { | ||
return "log_level" | ||
} | ||
|
||
func (*LogLevelRequest) Validate() error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
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.
in the validate method there is still a
// TODO checksum
does that need adding still?
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.
yeah, I have not added any intricacies for checking valid values for thinks like addresses, keys or object IDs with encoded fields