-
Notifications
You must be signed in to change notification settings - Fork 457
Validate account logic schema - Closes #1210 #1244
Validate account logic schema - Closes #1210 #1244
Conversation
Hi @robladbrook, thanks for your commits. |
@LucasIsasmendi understood. What changes would you like me to make given that the test currently passes? |
Test pass, but is not align with what is being used in the rest of the code. var report = this.scope.schema.validate(account, Account.prototype.schema); Check |
@LucasIsasmendi do these changes align with what you were thinking? |
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.
Thanks @robladbrook, now this is aligned with all the others schema definitions. Some minor changes and it will be approved.
type: 'integer', | ||
maximum: 32767 | ||
}, | ||
u_username: { |
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.
username
and u_username
should have the same definition and be the same structure as in Delegate.prototype.schema
username: {
type: 'string',
format: 'username'
}
logic/account.js
Outdated
maximum: 72 | ||
}, | ||
blockId: { | ||
type: 'string', |
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.
Add format: 'id'
logic/account.js
Outdated
}, | ||
address: { | ||
type: 'string', | ||
case: 'upper', |
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.
Replace case: 'upper'
with format: 'address'
type: 'string', | ||
format: 'publicKey' | ||
}, | ||
secondPublicKey: { |
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.
secondPublicKey
should be the same definition as publicKey
} | ||
] | ||
}, | ||
multisignatures: { |
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.
Change related multisig fields to be same as Multisignature.prototype.schema
- multisignatures, u_multisignatures is
keygroup
- multimin, u_ multimin is
min
- multilifetime, u_ multilifetime is
lifetime
logic/account.js
Outdated
maximum: 32767 | ||
}, | ||
fees: { | ||
type: 'integer' |
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.
Add minimum: 0
logic/account.js
Outdated
type: 'integer' | ||
}, | ||
rewards: { | ||
type: 'integer' |
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.
Add minimum: 0
@LucasIsasmendi I've updated the schema, but the test now fails because the model now requires 1+ in the multisig fields. Not sure if I should be updating the test model or allowing 0? |
@robladbrook please change all min values to 0 in schema definition multisig fields |
…unt-schema-validation-test
@LucasIsasmendi done! |
Closes #1210
I'm not sure if using
anyOf
introduces any side effects for any other areas of the code using model.filter? As far as I can tell it should be fine.Note: there is a flakey test on test/unit/logic/account.js which I think was introduced as part of #1211
should throw error when a numeric field receives non numeric value