Skip to content

Commit

Permalink
Fix jsonschema current int and address values from storage
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanSerikov committed Mar 5, 2021
1 parent c5667f5 commit fb7354b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions internal/jsonschema/maker.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,22 @@ func (model DefaultModel) fill(data gjson.Result, metadata meta.Metadata, node *
case consts.INT, consts.NAT, consts.MUTEZ:
jsonPath := getGJSONPath(path, binPath, indices...)
i := getDataByPath(jsonPath, consts.INT, data)
model[path] = i.Int()
case consts.STRING, consts.KEY, consts.KEYHASH, consts.CONTRACT, consts.ADDRESS, consts.SIGNATURE:
model[path] = i.Value()
case consts.ADDRESS:
jsonPath := getGJSONPath(path, binPath, indices...)
str := getDataByPath(jsonPath, consts.STRING, data)
if !str.Exists() {
str = getDataByPath(jsonPath, consts.BYTES, data)
}

address, err := unpack.Address(str.String())
if err != nil {
model[path] = str.Value()
} else {
model[path] = address
}
case consts.STRING, consts.KEY, consts.KEYHASH, consts.CONTRACT, consts.SIGNATURE:
jsonPath := getGJSONPath(path, binPath, indices...)
str := getDataByPath(jsonPath, consts.STRING, data)
s := str.String()
if !str.Exists() {
Expand Down

0 comments on commit fb7354b

Please sign in to comment.