-
Notifications
You must be signed in to change notification settings - Fork 37
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
strict json precision parsing #104
Comments
@canonbrother: Thanks for opening an issue, it is currently awaiting triage. The triage/accepted label can be added by foundation members by writing /triage accepted in a comment. DetailsI am a bot created to help the DeFiCh developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the DeFiCh/oss-governance-bot repository. |
@canonbrother: There are no 'area' labels on this issue. Adding an appropriate label will greatly expedite the process for us. You can add as many area as you see fit. If you are unsure what to do you can ignore this! You can add area labels by leaving a DetailsI am a bot created to help the DeFiCh developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the DeFiCh/oss-governance-bot repository. |
Thinking this simi simple way to do strict json precision parsing. Instead of "mapping", we could do "path" based. const object = {
value: 0,
values: [
9,
9,
],
items: [
{
a: 10,
b: 11,
},
{
a: 20,
b: 21,
}
],
deep: {
c: 0,
d: 0,
}
}
// you either define bignumber or it default to number
const pathPrecision = {
value: 'bignumber', // 0 = bignumber
values: 'bignumber', // [9,9] = bignumber
items: {
a: 'bignumber', // items: [{a: 10}, {a: 20}] = bignumber
// items: [{b: 11}, {b: 21}] = number
},
deep: 'bignumber' // {c:0,d:0} get parsed to bignumber
} |
@fuxingloh a edge case to take note of when implementing strict precision parsing. |
What would you like to be added:
Its not critical but also a note.
Currently the precision is loose on
while:
result:
expected:
note:
Two issues will be facing while implement the strict precision
ApiClient.call
's resp object structure -{ result, error, id }
Ideally for rpc call is only passing the relevant precision mapping object
Currently in order to remove the loose precision is to replace the
precision
by empty object{}
this causes the nested object cannot be parsed due to empty precision.
Why is this needed:
{foo: { bar: 123 }} !== { bar: 123 }
But its also convince-able to remain the loose precision
assume
bar
is a crypto amount, so why not parsing both??The text was updated successfully, but these errors were encountered: