-
Notifications
You must be signed in to change notification settings - Fork 246
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
Validate JSON config #240
Validate JSON config #240
Conversation
1021016
to
c7add9a
Compare
I consider this done at this point of time. I tried to make the validation more restrict but each time I was hit by some tests that allowed a given configuration. E.g. |
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.
cmd/statusd/utils.go
func testValidateNodeConfig
Please move this testing function to testing package eg. if you are testing utils create utils_test.go. We dont want to have an testing functions inside packages.
geth/params/validator.go
func NewValidator()
Can we simplify by return validator.New()
?
geth/common/types.go
- APIDetailedResponse
- APIFieldError
- APIError
Why this API prefix ? Can we simplify to something idiomatic ?
Eg. Response, Field, Error
We are using single char to point to the struct, so please, stick with that.
Ex.
func (fe APIFieldError) Error()
We can just use "f" or "e".
@MarinX it would be easier to reply to comments directly attached to source files, if it's possible.
You can't compile
👍 There are no custom validators, it can be simplified.
Also following convention here. In my opinion we shouldn't have something like
👍 Yeah, I will change this. |
058b7bb
to
557eba3
Compare
@MarinX, you're saying right things but not in the right time. We have a set of rules which should follow to avoid hell with merging: https://hackmd.io/s/rkgqzRWIb |
Seems like a plan. |
557eba3
to
f31da35
Compare
@adambabik I noticed what seems a mismatch in the value for the warning level. It is mentioned as being |
@pombeirp It should be |
@adambabik do you want me to change the code in https://github.com/status-im/status-go/blob/develop/geth/params/config.go#L292 to |
Yes, please. For now, that should be quite enough, however, I am not sure status-react validates config before starting a node. |
@adambabik yeah, even if it doesn't, it will avoid inducing people new to the codebase in error. I initially used |
Related to issue #149.
Changes
ValidateNodeConfig()
,NodeConfig
interface withValidate()
method,validate
tag to someNodeConfig
fields.Validated fields
Error formatting
Todo: